Summary
A command injection vulnerability in yt-dlp-web-ui allows attacker-controlled download parameters to influence commands executed by the generic downloader.
Because the vulnerable functionality can be reached remotely in exposed deployments, an attacker may execute operating-system commands with the privileges of the application process.
Affected context
The vulnerability occurs in the NewGenericDownload function within server/internal/downloaders/generic.go of yt-dlp-web-ui deployments up to version 4. It becomes risky when externally supplied params values reach command construction or process execution without sufficient separation between data and executable arguments.
Exploit preconditions
- Attack surface: Remote download functionality exposed through the yt-dlp-web-ui application
- Required access: Ability to submit or influence download parameters; authentication requirements depend on deployment configuration
- Trigger point: Processing a request by
NewGenericDownload - Why exploitation is possible: User-controlled parameter data may be incorporated into an operating-system command without reliable command and argument boundary enforcement
Why this happens
The underlying bug is improper neutralization of special elements in externally controlled input used to construct an operating-system command. This maps primarily to CWE-77: Command Injection, with CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component describing the broader failure to treat command-interpreted data as untrusted.
Potential impact
- An attacker may execute arbitrary commands on the application host
- The attacker could access, modify, or delete files available to the service account
- Sensitive application data or credentials may be exposed
- The service could be disrupted or used for unauthorized outbound activity
- A compromised process could enable lateral movement when excessive permissions or network access are available
General mitigation guidance
Mitigation generally focuses on ensuring that user-controlled values are never interpreted as shell syntax.
Common defensive patterns include:
- Prefer direct process-execution APIs that pass an executable and discrete argument list without shell interpretation
- Apply strict allowlists and type validation to download parameters
- Separate command construction from request parsing and reject unexpected fields or formats
- Avoid shell wrappers, concatenated command strings, and implicit evaluation of user input
- Run the downloader with a dedicated least-privilege account and restrict filesystem and network permissions
- Apply sandboxing or container isolation where practical, while treating isolation as a secondary control
How teams detect issues like this
Detection can combine static analysis, code review, runtime monitoring, and policy enforcement.
- Search for shell execution APIs, command-string concatenation, interpolation, and subprocess calls that receive request-derived values
- Review whether process APIs receive a discrete argument array or a single shell-parsed string
- Trace HTTP or API parameters through validation, command construction, and execution boundaries
- Add CI policies that flag shell invocation and untrusted data flows into process execution
- Monitor for unexpected child processes, unusual command-line arguments, and outbound connections from the downloader service
- Automated code review and data-flow analysis tools may help identify command-injection paths before deployment

