Summary
F5-TTS through version 1.1.20 contains a path traversal vulnerability in its finetune Gradio handlers, where user-supplied project names are passed directly into os.path.join() without constraining the final path to the intended base directory.
An unauthenticated attacker can supply absolute or traversal-based paths and cause the server to create arbitrary directories and JSON files anywhere on the filesystem that is writable by the application process.
Affected context
The vulnerability appears in the server-side Gradio handlers responsible for finetuning workflows in F5-TTS.
It occurs when project names from HTTP requests are used to construct filesystem paths for storing configuration or metadata without normalization or boundary checks.
Any deployment that exposes these finetune endpoints to untrusted clients, and runs with permissions to write beyond the intended project directory tree, can be affected.
Exploit preconditions
- Attack surface: Network-accessible Gradio finetune endpoints in the F5-TTS service.
- Required access: No prior authentication when the endpoints are publicly exposed (attacker can be an anonymous client).
- Trigger point: Sending crafted project name parameters that are interpreted as filesystem paths (e.g., absolute paths like
/tmp/EVILor traversal sequences). - Why exploitation is possible: The handler concatenates the user-controlled project name with a base directory via
os.path.join()and then writes JSON files to the resulting path without validating that the resolved path remains within the intended base directory.
Why this happens
This issue stems from improper neutralization of path elements when constructing filesystem paths from user input.
The code trusts the project name parameter and uses it directly in os.path.join(), assuming the base directory will constrain where files are written.
On most operating systems, absolute paths or crafted traversal segments override or escape the base directory, allowing writes to unintended locations.
This behavior aligns with CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the application fails to enforce a safe directory boundary before performing file operations.
Potential impact
- Creation of attacker-controlled JSON files at arbitrary writable filesystem locations.
- Overwriting or clobbering existing configuration or data files if paths collide with legitimate resources.
- Planting files that may be consumed by other components, potentially leading to logic manipulation or indirect code execution depending on how those files are later interpreted.
- Facilitating lateral movement or privilege abuse if written files influence scheduled tasks, loaders, or data processing pipelines.
General mitigation guidance
Effective mitigation focuses on enforcing strict directory boundaries and treating all path components as untrusted:
- Resolve the final path (e.g., with
realpath-style normalization) and explicitly verify it is a descendant of an approved base directory before any file writes. - Reject or sanitize project names that include path separators, traversal sequences, absolute paths, or other filesystem metacharacters, and instead allow only a constrained character set (e.g., alphanumerics, underscore, dash).
- Separate user-facing identifiers from filesystem paths by mapping project IDs to internally generated directory names rather than using user input directly in path construction.
- Apply least-privilege to the service account so it can write only inside dedicated application directories and not to system-wide locations.
How teams detect issues like this
Detection typically combines code-level and behavioral approaches:
- Static analysis rules that flag use of
os.path.join()or similar APIs where any path segment is derived from user-controlled input without subsequent boundary checks. - Code reviews that look for directory operations using request parameters, query strings, or other untrusted values, and verify they are normalized and validated.
- Runtime monitoring for unexpected directory creation or file writes outside the expected application data tree, especially under the service account used by F5-TTS.
- Integration of security-focused linters or SAST tools in CI/CD pipelines to automatically surface new path traversal patterns in handler code.

