Summary
AVideo contains an OS command injection flaw in the Live plugin's on_publish.php endpoint, where shell commands are re-wrapped in a double-quoted sh -c context after escaping.
By abusing command substitution via $() or backticks, an attacker can inject arbitrary operating system commands even when escapeshellarg() is applied.
Affected context
This vulnerability arises in AVideo deployments using the Live plugin where on_publish.php constructs shell commands for streaming or publishing workflows.
The affected code path first applies escapeshellarg() to user-influenced input but then passes the resulting command through an execAsync() helper that re-wraps it in sh -c "...".
In environments where attackers can control parameters sent to the on_publish endpoint (for example, via publishing URLs or request fields), the risk of command substitution is present.
Exploit preconditions
- Attack surface: HTTP interface exposed by the AVideo Live plugin, specifically the on_publish.php endpoint.
- Required access: Ability to trigger a publish event with attacker-controlled parameters (e.g., authenticated publisher or misconfigured public publish endpoint).
- Trigger point: When the Live plugin invokes
execAsync()to execute a shell command constructed from request input. - Why exploitation is possible: The command is re-wrapped inside
sh -c "...", enabling shell interpretation and command substitution ($()or backticks) to bypass earlier escaping and inject arbitrary OS commands.
Why this happens
The root cause is an improper neutralization of special elements used in OS command construction, mapping to CWE-78: Improper Neutralization of Special Elements used in an OS Command.
While the input is initially passed through escapeshellarg(), a subsequent execAsync() helper rebuilds the command inside a double-quoted sh -c string.
This re-introduces shell parsing semantics, allowing constructs like $() and backticks to be interpreted at execution time, effectively negating previous escaping and creating an injection channel.
Potential impact
- Remote command execution under the web server or application process account.
- Compromise of the underlying server hosting AVideo.
- Access to or exfiltration of sensitive data stored on the host.
- Deployment of web shells or persistence mechanisms.
- Lateral movement within the hosting environment or connected network.
General mitigation guidance
Mitigation should focus on eliminating shell interpretation for user-influenced data and enforcing strict separation between data and commands.
Common defensive patterns include:
- Avoiding
sh -cand similar shell wrappers when executing commands; prefer direct invocation of binaries with argument arrays where the runtime bypasses the shell. - Ensuring any helper functions (such as async execution wrappers) do not reintroduce shell parsing around already-escaped arguments.
- Applying a strict allowlist for commands and arguments used by the Live plugin, limiting inputs to known-safe patterns and formats.
- Running the AVideo application and Live plugin with least-privilege accounts, reducing the blast radius of any command execution.
- Segmenting and hardening the host environment (e.g., process confinement, containers, or chroot-like isolation) so that even successful command injection has limited impact.
How teams detect issues like this
Detection can combine code-level analysis with operational monitoring:
- Static analysis rules looking for
exec,shell_exec,system, or similar functions wrapped insh -cwhere arguments contain user-controlled data, even if initial escaping is present. - Code review checklists that flag any helper like
execAsync()which re-wraps commands and re-enables shell semantics after sanitization. - Configuration and policy enforcement that discourage generic shell wrappers for business logic and require structured command invocation.
- Runtime monitoring for unusual child processes spawned by the web server or PHP runtime, especially shells (
/bin/sh,/bin/bash) or unexpected utilities invoked during publish events.

