Summary
WWBN AVideo up to and including version 26.0 contains an OS command injection vulnerability in the sanitizeFFmpegCommand() function used to build ffmpeg commands.
Because $() command substitution is not stripped and the command is later executed via sh -c in execAsync(), an attacker able to supply a crafted encrypted payload can execute arbitrary system commands on the standalone encoder server.
Affected context
This issue arises in WWBN AVideo deployments that use the standalone encoder and rely on sanitizeFFmpegCommand() in plugin/API/standAlone/functions.php to clean user-influenced ffmpeg parameters.
The vulnerable flow occurs when:
- User-controlled or remotely supplied values are embedded in an ffmpeg command line,
- The application calls
sanitizeFFmpegCommand()to filter shell metacharacters, - The resulting string is passed into
execAsync(), which invokessh -cwith a double-quoted command.
Under these conditions, shell features like $() command substitution remain available to attacker-controlled input despite partial sanitization.
Exploit preconditions
- Attack surface: Standalone encoder API endpoints or workflows that accept encoded or encrypted payloads which ultimately influence ffmpeg command arguments.
- Required access: Ability to submit a valid, correctly encrypted payload that the encoder accepts as input for ffmpeg processing.
- Trigger point: Construction of the ffmpeg command string using
sanitizeFFmpegCommand()followed by execution throughexecAsync()usingsh -c "...". - Why exploitation is possible: The sanitizer removes some shell metacharacters (e.g.,
&&,;,|, backticks,<,>), but leaves$()intact. Inside a double-quotedsh -ccontext,$()is interpreted by the shell as command substitution, allowing embedded commands in attacker-controlled segments to run with the encoder process privileges.
Why this happens
The underlying bug is an incomplete input neutralization problem when constructing shell commands, aligning with CWE-78: Improper Neutralization of Special Elements used in an OS Command.
Instead of avoiding the shell entirely or using strict argument escaping, the code attempts to build a single shell command string and "sanitize" it by stripping a subset of dangerous metacharacters.
This blacklist-based approach fails to account for $() command substitution, which remains a powerful shell feature within the double-quoted sh -c environment, enabling attackers to smuggle arbitrary commands through seemingly cleaned ffmpeg arguments.
Potential impact
- Remote execution of arbitrary commands on the standalone encoder server.
- Reading, modifying, or deleting files accessible to the encoder process.
- Abuse of the encoder host to pivot within the network or scan internal services.
- Exfiltration of sensitive configuration, logs, or media assets.
- Deployment of additional malware, cryptominers, or backdoors on the encoder system.
General mitigation guidance
Effective mitigation for this class of vulnerability focuses on eliminating shell interpretation of untrusted data rather than trying to filter shell syntax.
Conceptual defensive patterns include:
- Avoid building shell command strings with concatenation; use APIs that pass arguments as arrays (e.g.,
exec/proc_openwith separate parameters) so the shell is not invoked. - If shell invocation is unavoidable, apply strict whitelisting of allowed characters and tokens, rejecting or encoding anything outside a conservative set rather than stripping known-bad patterns.
- Treat all user-influenced ffmpeg parameters as data, not templates; avoid allowing arbitrary flags or filters unless they can be validated against a known safe schema.
- Run encoder processes with least-privilege system accounts, restricted filesystem access, and minimal network permissions to limit blast radius in case of command execution.
- Centralize command construction logic and subject it to security review, reducing ad-hoc string building across the codebase.
How teams detect issues like this
Organizations can look for similar vulnerabilities using:
- Static analysis rules targeting:
- Use of
sh -cor similar shell invocation patterns. - String concatenation of variables into command lines.
- Custom "sanitization" routines that blacklist a small set of shell metacharacters.
- Code review cues, such as:
- Functions named
*sanitize*Command*that still produce a single shell string. - Places where ffmpeg or other CLI tools are invoked with user-derived input.
- Reliance on regular expressions or simple replaces to filter complex shell syntax.
- Policy enforcement, for example:
- Mandating argument-array execution APIs by default and flagging shell-based execution for manual approval.
- CI checks that search for
sh -cusage and require justification or security review. - Optional use of automated SAST/linters configured to detect command injection antipatterns and suspect sanitization functions.

