Severity:

HIGH RISK

(7.3)

Path Traversal in Bert-VITS2 Gradio Interface

CVE-2026-8756

Deferred

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

File System Access / Path Traversal

Severity:

HIGH RISK

(7.3)

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 vulnerability in the generate_config function of webui_preprocess.py in the Bert-VITS2 Gradio interface allows attackers to manipulate the data_dir argument to access arbitrary file system locations.

When exposed remotely via the web UI, this flaw can be abused to read or write files outside the intended directory scope, depending on how the application uses the path.

Affected context

The vulnerability occurs in Bert-VITS2 deployments that expose the Gradio-based web interface and allow user-controlled input for the data_dir parameter in preprocessing or configuration generation workflows.

It manifests when the application constructs file system paths directly from user input in generate_config without canonicalization, normalization, or strict directory constraints.

The risk is most pronounced when the application process runs with broad file system permissions and when the Gradio interface is reachable over a network.

Exploit preconditions

  • Attack surface: HTTP requests reaching the Gradio UI endpoints that invoke generate_config (typically remote web access).
  • Required access: Ability to submit or influence the data_dir parameter through the web interface or corresponding API.
  • Trigger point: The vulnerable function builds or uses paths derived from data_dir to read, write, or enumerate files on the server.
  • Why exploitation is possible: The code trusts data_dir as a safe directory path and fails to enforce constraints such as restricting paths to a known base directory, normalizing input, or rejecting traversal sequences like ../.

Why this happens

This vulnerability stems from insufficient validation and normalization of user-supplied file system paths.

The generate_config function uses the data_dir argument directly when constructing paths for configuration or preprocessing without enforcing that the resulting path stays within an expected base directory.

This aligns with CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where attacker-controlled relative segments (e.g., ../) or absolute paths can break out of the intended directory sandbox.

Potential impact

  • Read access to files outside the intended project or data directory, subject to process permissions
  • Overwriting or creating files in arbitrary locations used by the application, potentially impacting configuration or model assets
  • Exposure of sensitive information such as credentials, API keys, or system configuration if accessible to the application user
  • Facilitation of further attacks (e.g., log tampering, poisoning of input data, or aiding code execution via separate weaknesses)

General mitigation guidance

Effective mitigation focuses on restricting how file paths derived from user input are handled and ensuring that only approved locations are reachable:

  • Treat all path-related user input as untrusted and subject it to normalization and validation before use.
  • Resolve user-supplied paths against a fixed, known base directory and reject any path that escapes this base after canonicalization.
  • Disallow traversal patterns (such as ../ or absolute paths) at the input-validation layer and use allowlists of valid directory names or IDs instead of raw paths.
  • Run the application under a dedicated account with minimal file system privileges to limit the impact of any path misuse.
  • Prefer higher-level abstractions (e.g., virtual storage layers, per-tenant directories) rather than exposing direct file system layout to users.

How teams detect issues like this

Detection typically involves a combination of code-centric and operational techniques:

  • Static analysis: Flag patterns where user input (such as Gradio request parameters) flows directly into file-related calls (open, os.path.join, shutil, etc.) without intermediate validation or base-path enforcement.
  • Code review: Look for functions like generate_config that construct paths from request parameters; verify that they normalize paths and enforce directory boundaries.
  • Security testing: Use dynamic tests or fuzzing against the Gradio endpoints to identify whether ../ sequences or absolute paths produce unexpected file system behavior.
  • Policy enforcement: Adopt secure coding guidelines that prohibit direct use of unvalidated paths and integrate automated checks into CI/CD pipelines to detect path traversal patterns early.

Sources

SourceLink
gist.github.comgist.github.com/YLChen-007/550cb92f3489c317ff049fc7d7ea6b99
vuldb.comvuldb.com/submit/811175
vuldb.comvuldb.com/vuln/364383
vuldb.comvuldb.com/vuln/364383/cti

Frequently asked

questions

Yes, when the Gradio interface is exposed over the network and the data_dir parameter is controllable by remote users, the vulnerability can be exploited remotely via crafted requests.

It depends on how the Bert-VITS2 Gradio interface is deployed. If the UI or its underlying endpoints are accessible without authentication, any remote user may attempt exploitation; otherwise, an attacker would first need whatever level of access is required to reach the vulnerable functionality.

The safest pattern is to resolve all user-specified paths against a fixed base directory, perform canonicalization (e.g., realpath), and reject any path that escapes the allowed directory set. Using identifiers or options mapped to predefined directories rather than accepting raw paths further reduces risk.

Treat all file system paths derived from user input as untrusted, enforce strict directory boundaries, minimize file system privileges for the application, and incorporate static analysis and security-focused code review practices specifically targeting path handling logic.

Find out what's already
exploitable in your codebase.