Summary
Guardian language-system contains an OS command injection flaw where the untrusted id GET parameter is passed directly into a PHP exec() call without sanitization.
An unauthenticated remote attacker can append shell metacharacters to this parameter to execute arbitrary operating system commands on the server under the web server's privileges.
Affected context
This vulnerability occurs in Guardian language-system within speechmac_text.php, where a PHP script constructs a shell command that calls jobs/speech_audio_mac_text.php and includes user-controlled data.
The risk is present when the application exposes the id GET parameter over HTTP without authentication or robust input validation, and when PHP is allowed to execute shell commands via exec() on the underlying system.
Exploit preconditions
- Attack surface: Public-facing HTTP endpoint handling
speechmac_text.php - Required access: None; the endpoint is reachable without authentication
- Trigger point: Supplying a crafted
idquery parameter value containing shell metacharacters - Why exploitation is possible: The application interpolates the raw
$_GET['id']value directly into a shell command string passed toexec()without escaping, validation, or parameterization, allowing the attacker to break out of the intended command and inject arbitrary OS commands.
Why this happens
The core issue is the direct concatenation of untrusted input into an operating system command executed by PHP's exec() function.
This aligns with CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where user-supplied data influences the structure of a shell command.
Instead of treating the id parameter as data and constraining it to a safe format (such as a strictly validated numeric identifier), the application builds a raw shell command line, allowing shell metacharacters to alter command behavior and execute arbitrary instructions.
Potential impact
- Execution of arbitrary OS commands under the web server or PHP process account
- Full compromise of application data, including reading or modifying database contents via command-line tools
- Planting webshells or backdoors for persistent remote access
- Pivoting to other internal systems reachable from the compromised host
- Disruption of service through data deletion, resource exhaustion, or process killing
General mitigation guidance
Mitigation centers on removing direct shell command construction from untrusted input and minimizing reliance on OS-level execution.
Recommended design patterns include:
- Replacing
exec()and similar functions with native language APIs or libraries that perform the required task without invoking a shell - Strictly validating and constraining all external parameters (such as
id) to expected formats (e.g., numeric IDs, fixed tokens) and rejecting anything else - If OS commands are unavoidable, using parameterized execution that bypasses the shell and avoiding concatenation of raw user input into command strings
- Applying least-privilege principles so that the PHP/web server account has minimal filesystem and system permissions
- Segregating command-executing components into isolated services or containers with limited blast radius
How teams detect issues like this
Detection typically combines code-centric and operational approaches:
- Static analysis rules targeting PHP functions like
exec(),shell_exec(),system(),passthru(), and backtick operators when they receive data derived from$_GET,$_POST, or other user-controllable sources - Code review checklists that flag string-concatenated shell commands and require justification, strict validation, and safe invocation patterns
- Security linters or SAST tools integrated into CI pipelines, configured with policies to block merges when unsafe command execution patterns are found
- Runtime monitoring of command execution logs, web server logs, and EDR alerts for anomalous command invocations originating from the web application processes

