CVE-2026-35485
Path Traversal in text-generation-webui Allows Arbitrary File Read
Publication date: 2026-04-07
Last updated on: 2026-04-28
Assigner: GitHub, Inc.
Description
Description
CVSS Scores
EPSS Scores
| Probability: | |
| Percentile: |
Meta Information
Affected Vendors & Products
| Vendor | Product | Version / Range |
|---|---|---|
| oobabooga | textgen | to 4.3 (exc) |
Helpful Resources
Exploitability
| CWE ID | Description |
|---|---|
| CWE-22 | The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. |
Attack-Flow Graph
AI Powered Q&A
How does this vulnerability affect compliance with common standards and regulations (like GDPR, HIPAA)?:
This vulnerability allows unauthenticated attackers to read any file on the server filesystem, including sensitive files such as SSH private keys, environment files, API tokens, and application configurations.
Exposure of such sensitive information can lead to unauthorized access and data breaches, which may violate data protection regulations like GDPR and HIPAA that require safeguarding personal and sensitive data.
Since the vulnerability enables high confidentiality impact without requiring authentication, it increases the risk of non-compliance with these standards due to potential unauthorized data disclosure.
Can you explain this vulnerability to me?
CVE-2026-35485 is a high-severity path traversal vulnerability in the text-generation-webui project, specifically in the load_grammar() function before version 4.3.
The vulnerability arises because the load_grammar() function reads files based on a parameter that is not validated or sanitized. This parameter comes from a Gradio Dropdown component, but Gradio does not enforce server-side validation, allowing attackers to submit arbitrary directory traversal strings like '../../../etc/passwd'.
As a result, an unauthenticated attacker can send crafted POST requests to the API endpoint and read any file on the server filesystem without restriction on file extensions.
How can this vulnerability impact me? :
This vulnerability allows an unauthenticated remote attacker to read any file accessible by the server process.
- Exposure of sensitive files such as /etc/passwd, SSH private keys (~/.ssh/id_rsa), .env files, API tokens, and application configuration files.
- Potential compromise of server confidentiality due to unauthorized file disclosure.
- Increased risk in default or cloud deployments where authentication is optional or the server is exposed remotely.
How can this vulnerability be detected on my network or system? Can you suggest some commands?
This vulnerability can be detected by attempting to exploit the unauthenticated path traversal in the load_grammar() API endpoint of the text-generation-webui server.
A practical detection method is to send a crafted POST request to the vulnerable endpoint with a directory traversal payload and observe if the server returns the contents of arbitrary files.
Example commands to test for the vulnerability include:
- Start the server (if testing locally): python server.py --listen-port 7861
- Send a POST request with a directory traversal payload: curl -X POST http://127.0.0.1:7861/gradio_api/call/load_grammar -H "Content-Type: application/json" -d '{"data": ["../../../etc/passwd"]}'
- Retrieve the file contents using the returned event_id: curl http://127.0.0.1:7861/gradio_api/call/load_grammar/<event_id>
If the contents of /etc/passwd or other sensitive files are returned, the system is vulnerable.
What immediate steps should I take to mitigate this vulnerability?
The immediate mitigation step is to upgrade the text-generation-webui to version 4.3 or later, where this vulnerability is fixed.
If upgrading is not immediately possible, apply filename sanitization in the load_grammar() function by using os.path.basename(name) before constructing the file path to prevent directory traversal.
Additionally, restrict access to the server by enabling authentication (e.g., using the --gradio-auth option) and avoid exposing the server publicly without proper access controls.