Summary
GPT-SoVITS webui.py suffers from an OS command injection flaw where user-controlled Gradio textbox input is interpolated directly into shell commands with shell=True.
An unauthenticated attacker can supply crafted path parameters containing shell metacharacters to execute arbitrary operating system commands as the web server process user.
Affected context
This vulnerability occurs in GPT-SoVITS deployments that expose the Gradio-based web UI to users or networks where untrusted clients are present.
The affected functions (ASR, slice, denoise, and uvr5) build shell commands that include values taken directly from textboxes intended to hold file or path parameters.
When the application invokes these commands with shell=True, the shell interprets any metacharacters in the user input, enabling command injection if no additional validation or isolation is in place.
Exploit preconditions
- Attack surface: HTTP interface of the GPT-SoVITS Gradio web UI (webui.py).
- Required access: Network accessibility to the web UI; no authentication is required by default.
- Trigger point: Invoking ASR, slice, denoise, or uvr5 actions with textbox fields populated by attacker-controlled path values.
- Why exploitation is possible: User input is concatenated into shell command strings executed with
shell=True, without robust validation, escaping, or parameterization, allowing the shell to interpret injected metacharacters as separate commands.
Why this happens
The underlying issue is the construction of shell commands by concatenating untrusted user input into command strings and executing them with shell=True.
This pattern falls under CWE-78: OS Command Injection, where the application passes unsafe input to a command interpreter without appropriate neutralization or parameterization.
Instead of using APIs that treat user input as data (e.g., argument arrays or high-level library calls), the application delegates parsing and execution to the shell, giving attackers control over the command line structure.
Potential impact
- Execution of arbitrary OS commands with the privileges of the GPT-SoVITS server process.
- Reading, modifying, or deleting files accessible to the application user.
- Installing backdoors or pivoting to other systems reachable from the host.
- Compromising generated audio data, models, or configuration artifacts.
- Using the host as a launchpad for broader network attacks or cryptomining workloads.
General mitigation guidance
Effective mitigation centers on removing direct shell interpretation of user input and minimizing the need for shell invocation.
Common defensive patterns include:
- Replacing
shell=Trueinvocations with parameterized subprocess calls that pass arguments as lists, ensuring the OS does not re-parse a command line string. - Using high-level library APIs for file manipulation, audio processing, or model handling instead of external shell tools when feasible.
- Applying strict validation on path-like parameters, such as allowing only expected filename patterns, whitelisted directories, or mapped identifiers instead of raw paths.
- Running the web UI under a dedicated, least-privileged account with constrained file system and network access to reduce blast radius if command execution occurs.
- Introducing isolation mechanisms such as containers, chroot jails, or sandboxed environments for any components that must execute external commands.
How teams detect issues like this
Organizations can detect similar OS command injection risks through a combination of static, dynamic, and process-level monitoring:
- Static analysis rules that flag usage of subprocess APIs with
shell=True, especially when combined with string concatenation of variables that originate from HTTP request handlers or UI inputs. - Code review checklists that specifically call out command construction paths, requiring reviewers to verify safe argument handling, whitelisting, or the absence of shell invocations.
- Security policies in CI pipelines that disallow or require justification for shell-based execution in web-exposed components.
- Runtime monitoring for unusual child processes spawned by the web UI, anomalous command lines, or execution of unexpected binaries, optionally using host-based intrusion detection or EDR tooling.

