CVE-2021-3199: ONLYOFFICE Document Server Path Traversal Arbitrary File Upload via JWT Image Upload Parameter
HERMES THREAT SCORE & ENTERPRISE COLLABORATION GATEWAY EVALUATION
Target:ONLYOFFICE Document Server (ONLYOFFICE Docs) โ DocService /upload Handler 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.
CVE-2021-3199: ONLYOFFICE Document Server Path Traversal Arbitrary File Upload via JWT Image Upload ParameterVULNERABILITY
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.”
- [vulnerability_report]
- [government_confirmation]CISA verified active exploitation in the wild and mandated federal remediation deadline in KEV entry. — Source: Cybersecurity & Infrastructure Security Agency (CISA): CISA Adds CVE-2026-59822 to Known Exploited Vulnerabilities Catalog (Reliability: VERY_HIGH)
1. Technical Context & Affected Architecture Matrix
Section titled โ1. Technical Context & Affected Architecture Matrixโ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.
| Parameter | Technical Specification | Operational Details |
|---|---|---|
| CVE Identifier | CVE-2021-3199 | International vulnerability catalog identifier |
| Affected Software | ONLYOFFICE Document Server (ONLYOFFICE Docs) | Enterprise office suite backend for private clouds |
| Vulnerable Component | DocService/sources/common/upload.js (/upload route) | Image upload and temporary attachment processing handler |
| Vulnerability Class | CWE-22 / CWE-434 | Path Traversal / Arbitrary File Overwrite |
| Attack Vector | HTTP POST (/upload) | Form data or JSON request with traversed image path |
| Remediation Release | ONLYOFFICE Document Server v5.6.3 | Path 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 | +-------------------------------------------+2. Root Cause Analysis & Vulnerable Code Anatomy
Section titled โ2. Root Cause Analysis & Vulnerable Code Anatomyโ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.jsexports.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.
3. Real-World Weaponization & Threat Telemetry
Section titled โ3. Real-World Weaponization & Threat Telemetryโ- 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.
- Initial Foothold Campaigns: Threat actors target self-hosted ONLYOFFICE instances exposed on ports 80/443 connected to Nextcloud enterprise instances.
- Lateral Movement: Once inside the container or host under the
dsuser, attackers extract PostgreSQL database credentials from/etc/onlyoffice/documentserver/local.json, access document storage vaults, and pivot into the internal network.
4. Forensic Triage & Detection Engineering
Section titled โ4. Forensic Triage & Detection Engineeringโtitle: ONLYOFFICE Document Server Path Traversal File Uploadid: d7193199-3199-4c12-8821-cve20213199status: experimentaldescription: 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-3199author: Hermes Codex CTIdate: 2026-10-09logsource: category: webserverdetection: 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_traversalfields: - c-ip - cs-method - cs-uri-stem - cs-uri-query - sc-statusfalsepositives: - None observed; traversal tokens in /upload filenames are uniformly malicious.level: critical// Azure Sentinel / Syslog: Detect ONLYOFFICE DocService Suspicious File WritesSyslog| where ProcessName in ("node", "documentserver")| where SyslogMessage has "/upload" and SyslogMessage has_any ("..", "%2e%2e", "/server/DocService/")| project TimeGenerated, HostName, ProcessName, SyslogMessage#!/usr/bin/env bash# Hermes DFIR: Triage ONLYOFFICE Server for Traversal File OverwritesDOCS_DIR="/var/www/onlyoffice/documentserver"
echo "[*] Checking DocService directories for modified or unexpected JavaScript files..."find "$DOCS_DIR/server" -type f -name "*.js" -mtime -30 -exec ls -la {} +
echo "[*] Searching Nginx access logs for traversal attempts on /upload..."grep -E "POST .*/upload.*(\.\.|%2e%2e)" /var/log/onlyoffice/documentserver/nginx.access.log 2>/dev/null5. Remediation Strategy & Mitigation Guidance
Section titled โ5. Remediation Strategy & Mitigation Guidanceโ-
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 -
Restrict Web Server File System Permissions: Ensure the
dsprocess 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/. -
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.