Summary
Guardian language-system contains an OS command injection flaw where an HTTP GET parameter is concatenated directly into a PHP exec() call without sanitization.
An unauthenticated remote attacker can craft a request with shell metacharacters in the id parameter to execute arbitrary operating system commands on the server.
Affected context
This vulnerability occurs in deployments of the Guardian language-system that expose the text_to_subtitles.php endpoint to untrusted clients.
The issue arises when the application constructs a shell command using PHP exec() and directly interpolates the id GET parameter, without input validation, escaping, or use of safer process-spawning primitives.
Any environment where this endpoint is reachable over a network and mapped to an active PHP interpreter may be affected, regardless of authentication configuration.
Exploit preconditions
- Attack surface: HTTP interface to text_to_subtitles.php
- Required access: None; the endpoint is reachable without authentication
- Trigger point: A request supplying a crafted id GET parameter that is included in the exec() command line
- Why exploitation is possible: The id parameter is concatenated into a shell command string and executed, allowing shell metacharacters and additional commands to be interpreted by the underlying shell
Why this happens
The root cause is unsafely constructing shell commands using user-controlled input and passing them to PHP exec(), aligning with CWE-78: Improper Neutralization of Special Elements used in an OS Command.
Instead of treating user input as opaque data, the code interpolates the id parameter directly into the command string, enabling attackers to inject shell syntax (e.g., separators, redirection, pipelines) that the shell interprets as new commands or arguments.
This pattern reflects a broader bug class where applications delegate work to the operating system shell without proper escaping, validation, or use of parameterized process execution APIs.
Potential impact
- Execution of arbitrary OS commands with the web server or PHP process privileges
- Reading, modifying, or deleting files accessible to the application user
- Installation of backdoors, web shells, or additional malicious tooling
- Access to sensitive configuration data such as database credentials or API keys
- Lateral movement within the hosting environment or internal network, depending on privileges
- Service disruption or denial-of-service by terminating processes or exhausting system resources
General mitigation guidance
Effective mitigation focuses on removing direct shell command construction with user input and minimizing reliance on the shell.
Common defensive patterns include:
- Replacing exec()-based shell calls with language-level APIs (e.g., PHP functions or libraries) that perform the desired operation without invoking a shell
- When external processes are truly necessary, using process execution APIs that pass arguments as arrays (e.g., proc_open with escapeshellarg or equivalent), avoiding shell interpretation
- Strictly validating and constraining any external parameters (e.g., whitelisting ids against known formats or enumerations instead of accepting arbitrary strings)
- Running the web application under a minimally privileged account and isolating it via containers or chroot where appropriate, to reduce the blast radius of a compromise
- Applying a defense-in-depth input validation strategy so that externally sourced values are treated as untrusted and normalized early in request handling
How teams detect issues like this
Detection typically combines code-centric and behavior-centric approaches:
- Static code analysis rules that flag use of exec(), system(), shell_exec(), and similar functions when concatenated with superglobals like $_GET, $_POST, or $_REQUEST
- Code review practices that require justification and scrutiny for any shell invocation, looking specifically for string concatenation involving external input
- Security linters or CI checks configured to block merges when unsafe command construction is detected
- Runtime monitoring of process creation by the web server user, alerting on unusual commands or arguments indicative of injection
- Web application firewall (WAF) or reverse proxy rules that detect and optionally block requests containing obvious shell metacharacters in parameters known to be at risk

