/

CVE-2026-35050

Severity:

CRITICAL RISK

(9.1)

Path Traversal File Write in text-generation-webui

CVE-2026-35050

Analyzed

Vulnerability type

Category:

Path Traversal / Arbitrary File Write

CWE:

CWE-22

Impact:

Remote Code Execution via Arbitrary Python File Overwrite

Severity:

CRITICAL RISK

(9.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A path traversal-style arbitrary file overwrite in text-generation-webui allows extension settings to be saved as .py files in the application root directory.

If abused, an attacker can overwrite Python modules such as download-model.py and later trigger their execution via the Model download functionality, leading to remote code execution.

Affected context

The vulnerability occurs in text-generation-webui deployments where:

  • Extension settings can be saved in .py format, and
  • The application allows writing those settings files into the app root directory (alongside core Python scripts), and
  • Application logic can later import or execute those .py files as part of normal workflows (e.g., model download).

It is most relevant in multi-user or shared environments, or where untrusted users have access to the web UI to configure extensions and save settings.

Exploit preconditions

  • Attack surface: Web interface of text-generation-webui, specifically the extension settings functionality.
  • Required access: Ability to authenticate or otherwise gain UI access with permission to configure extensions and save their settings.
  • Trigger point: Saving extension settings in .py format to the application root and then invoking functionality (like the "Model" menu) that executes or imports the overwritten Python file (e.g., download-model.py).
  • Why exploitation is possible: The application allows user-controlled paths/filenames for extension settings to be written into sensitive code directories without proper validation or directory restrictions, and later trusts those files as executable code.

Why this happens

This issue stems from insufficient validation and confinement of file paths when persisting extension settings.

By allowing users to save settings as .py files in the application root directory, the system effectively lets untrusted input control both the location and content of Python source files that are later executed.

This maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, where the application fails to constrain file operations to a safe directory and does not enforce a clear separation between data files and executable code.

The insecure pattern is treating configuration-like data as arbitrary files in a shared code directory, enabling overwrite of security-sensitive modules that are loaded or run as part of normal application behavior.

Potential impact

  • Arbitrary Python code execution when the overwritten script (such as download-model.py) is triggered.
  • Full compromise of the text-generation-webui process, including access to any models, prompts, and data it handles.
  • Lateral movement within the hosting environment, depending on the privileges of the application user.
  • Installation of backdoors or persistence mechanisms within the application codebase.
  • Data exfiltration or tampering with downloaded models and other artifacts.

General mitigation guidance

Effective mitigation focuses on strict separation of user-controlled content from executable code and robust path handling:

  • Constrain all extension settings and user-generated files to a dedicated, non-executable data directory that is never imported as code.
  • Normalize and validate file paths before writing, ensuring they cannot escape designated directories (reject absolute paths, .. segments, or unexpected extensions).
  • Treat configuration as data only: avoid allowing .py or other executable extensions for settings files; prefer structured formats like JSON, YAML, or TOML.
  • Enforce least-privilege file system permissions so that the web UI process cannot modify application source code directories.
  • Apply secure-by-default file naming conventions that the user cannot override, such as auto-generated, fixed patterns scoped to each extension.

How teams detect issues like this

Organizations can detect and monitor for this class of vulnerability through:

  • Static analysis rules and linters that flag file-write operations using user-controlled paths without normalization and directory checks.
  • Code review guidelines that require a clear separation between configuration directories and executable code directories, with special scrutiny on any .py file creation.
  • Runtime monitoring or file integrity checks (e.g., checksums, watchdogs) on core application scripts like download-model.py to detect unexpected modifications.
  • Logging and alerting for suspicious write operations to application root or code directories originating from web-facing request handlers.
  • Periodic security scans for generic path traversal and arbitrary file write patterns in web UI components and extension systems.

Sources

SourceLink
github.comgithub.com/oobabooga/text-generation-webui/security/advisories/GHSA-jg96-p5p6-q3cv

Frequently asked

questions

Yes, in environments where the text-generation-webui interface is exposed over the network and untrusted or semi-trusted users can access the extension settings, a remote attacker may exploit it to achieve code execution.

The attacker typically needs access to the web UI with sufficient permissions to configure extensions and save their settings. They do not necessarily need direct shell access or file system access; the file overwrite is performed through the application itself.

The safest pattern is to ensure extension settings are stored only as non-executable data in a dedicated configuration directory, with strict path validation that prevents writing outside of that directory and forbids executable extensions like .py.

Adopt a design principle that strictly separates data from code, enforce robust path normalization and directory whitelisting for all file operations influenced by user input, and include security-focused code review and automated checks for path traversal and arbitrary file write patterns in the development lifecycle.

Find out what's already
exploitable in your codebase.