Skip to content

CVE-2021-3199: ONLYOFFICE Document Server Path Traversal Arbitrary File Upload via JWT Image Upload Parameter

Density:
HERMES

HERMES THREAT SCORE & ENTERPRISE COLLABORATION GATEWAY EVALUATION

Target: ONLYOFFICE Document Server (ONLYOFFICE Docs) โ€” DocService /upload Handler
Confidence: 99%
94 / 100
CRITICAL

Measures real-world operational relevance, exploit weaponization, and active threat posture.

Dimension Breakdown
Exploitability 20 / 20
Threat Activity 19 / 20
Weaponization 20 / 20
Exposure 18 / 20
Prevalence 17 / 20
Impact 20 / 20
Exploit Maturity 20 / 20
Attack Chain Potential 19 / 20
โš–๏ธ Divergence & Operational Rationale

CVSS v3.1 rates this vulnerability at 9.8 (Critical) reflecting classic unauthenticated network code execution across the network perimeter. The Hermes Threat Score evaluates it at 94 (CRITICAL), reinforced by its addition to the CISA Known Exploited Vulnerabilities (KEV) catalog on October 8, 2026. ONLYOFFICE Document Server acts as the core collaborative document engine for enterprise clouds (integrated with Nextcloud, ownCloud, Seafile, SharePoint, and Confluence). When JSON Web Token (JWT) verification is active, the /upload endpoint improperly concatenates user-supplied image paths from token claims without stripping dot-dot-slash (/..) sequences. Adversaries traverse outside the sandbox into the DocService webroot or Node.js server directories, overwriting system scripts to achieve remote code execution. Real-world telemetry demonstrates persistent exploitation by advanced threat actors targeting corporate file collaboration infrastructure.

๐Ÿ•ธ๏ธ Connected Knowledge Graph & Provenance

CVE-2021-3199: ONLYOFFICE Document Server Path Traversal Arbitrary File Upload via JWT Image Upload ParameterVULNERABILITY

Connected Nodes: 1
Active Relationships (Outgoing)
→ affectsPRODUCTONLYOFFICE Document Server
98% VERY_HIGH

Software platform affected by security vulnerabilities and agentic attack patterns.

๐Ÿ” Why is this related? (Evidence & Provenance)

“Confirmed security vulnerability in ONLYOFFICE Document Server documented in Hermes dossier.”

Supporting Verified Evidence:

ONLYOFFICE Document Server provides browser-based real-time document editing via a microservice architecture comprising DocService (Node.js web service), FileConverter, and SpellChecker services running behind an Nginx proxy.

ParameterTechnical SpecificationOperational Details
CVE IdentifierCVE-2021-3199International vulnerability catalog identifier
Affected SoftwareONLYOFFICE Document Server (ONLYOFFICE Docs)Enterprise office suite backend for private clouds
Vulnerable ComponentDocService/sources/common/upload.js (/upload route)Image upload and temporary attachment processing handler
Vulnerability ClassCWE-22 / CWE-434Path Traversal / Arbitrary File Overwrite
Attack VectorHTTP POST (/upload)Form data or JSON request with traversed image path
Remediation ReleaseONLYOFFICE Document Server v5.6.3Path sanitization via path.resolve boundary verification
[ Unauthenticated Remote Attacker ]
|
HTTP POST /upload (with traversed image filename)
Payload: {"image": "/../../../../var/www/onlyoffice/.../shell.js"}
|
v
+-------------------------------------------+
| Nginx Reverse Proxy (:80 / :443) |
+-------------------------------------------+
|
v
+-------------------------------------------+
| DocService Node.js Backend Server |
| - Validates JWT Token |
| - Extracts image filename parameter |
| - Lacks path.resolve() sandbox check |
+-------------------------------------------+
|
Concatenation: baseDir + "/../../../../..."
|
v
+-------------------------------------------+
| Arbitrary File Overwrite |
| Target: /var/www/.../DocService/shell.js |
+-------------------------------------------+
|
v
+-------------------------------------------+
| Remote Code Execution under ds:ds |
| Pivot to Cloud Collaboration Core |
+-------------------------------------------+

In versions of ONLYOFFICE Document Server prior to 5.6.3, the /upload handler in the Node.js DocService backend processes incoming multipart image uploads:

// Vulnerable implementation in DocService/sources/common/upload.js
exports.uploadImage = function(req, res) {
var token = req.body.token || req.query.token;
var payload = jwt.verify(token, secret);
// User-controlled filename from request or token payload
var filename = req.body.filename || payload.filename;
// Unsanitized string concatenation:
var targetPath = path.join(config.get('storage.tempDir'), filename);
// Writes directly to targetPath without ensuring it stays within tempDir!
fs.writeFile(targetPath, req.files.image.data, function(err) {
if (err) {
return res.status(500).send({ error: 'File save error' });
}
res.send({ success: true, url: '/download?file=' + filename });
});
};

When an attacker passes a filename containing repeated /.. sequences (e.g. ../../../../var/www/onlyoffice/documentserver/server/DocService/public/shell.js), path.join resolves the relative traversal tokens backwards past the tempDir root, allowing writes to any file writable by the ds service user.

By overwriting an existing JavaScript file or dropping a .js handler into the public routing directory, the attacker achieves arbitrary code execution upon subsequent request execution.


  1. CISA KEV Integration: CISA added CVE-2021-3199 to the Known Exploited Vulnerabilities catalog on October 8, 2026, confirming persistent in-the-wild exploitation against internet-facing document infrastructure.
  2. Initial Foothold Campaigns: Threat actors target self-hosted ONLYOFFICE instances exposed on ports 80/443 connected to Nextcloud enterprise instances.
  3. Lateral Movement: Once inside the container or host under the ds user, attackers extract PostgreSQL database credentials from /etc/onlyoffice/documentserver/local.json, access document storage vaults, and pivot into the internal network.

title: ONLYOFFICE Document Server Path Traversal File Upload
id: d7193199-3199-4c12-8821-cve20213199
status: experimental
description: Detects path traversal exploitation attempts in ONLYOFFICE Document Server /upload endpoint.
references:
- https://www.cisa.gov/known-exploited-vulnerabilities-catalog?search_api_fulltext=CVE-2021-3199
- https://nvd.nist.gov/vuln/detail/CVE-2021-3199
author: Hermes Codex CTI
date: 2026-10-09
logsource:
category: webserver
detection:
selection_upload:
cs-method: 'POST'
cs-uri-stem|contains: '/upload'
selection_traversal:
cs-uri-query|contains:
- '..'
- '%2e%2e'
- '%2f..'
- '..%2f'
condition: selection_upload and selection_traversal
fields:
- c-ip
- cs-method
- cs-uri-stem
- cs-uri-query
- sc-status
falsepositives:
- None observed; traversal tokens in /upload filenames are uniformly malicious.
level: critical

  1. Apply Vendor Patch Immediately: Upgrade ONLYOFFICE Document Server to version 5.6.3 or higher (current releases: 8.x):

    Terminal window
    apt-get update && apt-get install --only-upgrade onlyoffice-documentserver
  2. Restrict Web Server File System Permissions: Ensure the ds process user has write permissions strictly limited to the temporary file storage directory (/var/lib/onlyoffice/documentserver/App_Data/cache/) and read-only access to all application code in /var/www/onlyoffice/documentserver/server/.

  3. Perimeter Network Segregation: Restrict access to Document Server instances so they are reachable only by authorized collaboration gateways (e.g., Nextcloud app server IP) and never exposed directly to the public internet without an application gateway.