1. Executive Summary & Scope
Command Injection occurs when an application executes host operating system commands using system shells (`exec`, `system`, `passthru`, `shell_exec`, `popen`) and concatenates untrusted user input directly into the command string. Attackers append shell metacharacters (`;`, `&`, `|`, `` ` ``, `$()`) to execute arbitrary host commands.
2. Threat Model & Attack Vectors
Attackers exploit a network diagnostic or PDF generation feature to execute reverse shells, dump environment variables, install rootkits, and establish persistent access on the host server.
3. Code Analysis & Remediation Playbook
Vulnerable Implementation Pattern
$output";
Hardened Defense-in-Depth Implementation
4. Audit Verification Checklist & Pass Criteria
| Verification Phase | Audit Test Description | Mandatory Passing Criteria |
|---|---|---|
| Metacharacter Injection Testing | Submit payloads containing `;`, `&&`, `|`, `$(whoami)`, `` `id` ``. | Characters are either rejected by strict input validator or passed as literal strings without shell interpretation. |
| Whitelisting Audit | Verify that input parameters match strict regex (e.g. `/^[a-zA-Z0-9_\-\.]+$/`). | Invalid characters trigger immediate validation rejection before execution. |
| Container & User Isolation | Verify application worker runs as unprivileged user with restricted filesystem rights. | Worker cannot execute `/bin/sh` or modify system binaries even under hypothetical injection. |
WebOTG Application Security Directorate
WebOTG provides benchmark reference documentation, automated matrix evaluators, and security test harnesses for government digital platforms, WQMS architectures, and STQC compliance frameworks.