Summary
Pheditor: Terminal command-allowlist bypass via argument injection leads to RCE, surviving vector after the metacharacter-sanitization fixes
pheditor's terminal feature restricts callers to an allowlist of commands (TERMINAL_COMMANDS) and rejects shell metacharacters. The allowlist is enforced as a PREFIX match with no argument validation, and the allowlist includes binaries that grant arbitrary command execution through their own options (find, git, php, tar, grep). A caller can therefore run any command using only allowlisted binaries and no rejected metacharacter, escaping the allowlist restriction the terminal feature relies on.
Relationship to the prior terminal advisories (this is a surviving, distinct vector)
The prior terminal advisories were all shell-metacharacter injections: GHSA-9643-6xjp-vx57 ($()), GHSA-wg4w-wr5q-6vjc (|, backtick, newline), GHSA-jvc5-58fv-w8cq (; via the dir field). The current code rejects those characters. This report is a different class, CWE-88 argument injection through an allowlisted binary's flags, which the metacharacter denylist does not address.
Root cause (HEAD, v2.0.6)
In the terminal action handler of pheditor.php:
:588rejects&,;,|,$, backtick,\n,\r. It does NOT reject space,-,{,},+,/,..:595-605checks the command againstTERMINAL_COMMANDS(defined:25:ls,...,php,...,git,find,grep,...,tar,...,composer,exit) using a PREFIX match:strlen($command) >= strlen($value) && substr($command, 0, strlen($value)) == $value. There is no word boundary and no validation of the arguments that follow.:617runs the command through the shell unchanged:shell_exec((empty($dir) ? null : 'cd ' . escapeshellarg($dir) . ' && ') . $command . ' && echo \ ; pwd').
So a command beginning with an allowlisted binary, carrying a code-exec flag, and containing none of the rejected characters reaches shell_exec intact.
Proof of concept (reproduced)
POST to the terminal action with:
command = find . -maxdepth 0 -exec touch /tmp/PWNED {} +
dir = (any)
This contains no rejected metacharacter, prefix-matches the allowlisted find, and find -exec runs an arbitrary program. A faithful harness mirroring the three guards (poc/reproduction.sh, poc/transcript.txt) creates the marker file. Other allowlisted-binary payloads with the same property: git -c alias.x='!touch /tmp/PWNED' x, php -r 'system("id");', tar -cf /dev/null --checkpoint=1 --checkpoint-action=exec="touch /tmp/PWNED" ..
Impact
Arbitrary command execution on the host, under the web server's privileges, for a caller with the terminal permission (enabled in the default configuration). The exposure is amplified by GHSA-p4h7-p9rj-2pq2 (hardcoded default admin password with no forced change): a default deployment grants the authenticated access needed to reach the terminal action with a single known credential, making the chain effectively unauthenticated RCE.
Untrusted input reaches a shell command, allowing arbitrary commands to run on the host. Typical impact: code execution in the application's environment.
GHSA-G3HQ-HPHG-8FHH has a CVSS score of 8.8 (High). The vector is network-reachable, low privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (2.0.7); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
Validate the FULL command, not just its prefix: tokenize and require the program to be an allowlisted binary AND constrain its arguments (reject -exec/-execdir for find, -c/--upload-pack for git, -r/-d for php, --checkpoint-action/--to-command for tar, -f/--file program forms, etc.), or run each command as an argv array through a restricted launcher with no shell, or remove the code-exec-capable binaries from the allowlist. A prefix allowlist over a shell sink cannot constrain capability.
Credit: anir0y (independent security research).
Frequently Asked Questions
- What is GHSA-G3HQ-HPHG-8FHH? GHSA-G3HQ-HPHG-8FHH is a high-severity OS command injection vulnerability in pheditor/pheditor (composer), affecting versions <= 2.0.6. It is fixed in 2.0.7. Untrusted input reaches a shell command, allowing arbitrary commands to run on the host.
- How severe is GHSA-G3HQ-HPHG-8FHH? GHSA-G3HQ-HPHG-8FHH has a CVSS score of 8.8 (High). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of pheditor/pheditor are affected by GHSA-G3HQ-HPHG-8FHH? pheditor/pheditor (composer) versions <= 2.0.6 is affected.
- Is there a fix for GHSA-G3HQ-HPHG-8FHH? Yes. GHSA-G3HQ-HPHG-8FHH is fixed in 2.0.7. Upgrade to this version or later.
- Is GHSA-G3HQ-HPHG-8FHH exploitable, and should I be worried? Whether GHSA-G3HQ-HPHG-8FHH is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether GHSA-G3HQ-HPHG-8FHH is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix GHSA-G3HQ-HPHG-8FHH? Upgrade
pheditor/pheditorto 2.0.7 or later.