GHSA-9643-6xjp-vx57
HIGHGHSA-9643-6xjp-vx57 is a high-severity (CVSS 8.8) OS Command Injection vulnerability in pheditor/pheditor. O3 Security confirms whether GHSA-9643-6xjp-vx57 is actually reachable in your code before you act, and blocks exploitation at runtime until you patch.
Pheditor has an authenticated terminal command whitelist bypass
EPSS Exploitation Probability
EPSS (Exploit Prediction Scoring System) is a daily probability model maintained by FIRST.org. It estimates the likelihood a CVE will be exploited in production environments within the next 30 days, derived from real-world threat intelligence signals.
How urgent is this, really
GHSA-9643-6xjp-vx57 plotted by exploitation likelihood (EPSS) against impact (CVSS). The shaded corner — EPSS 50%+ and CVSS 7.0+ — is where this CVE doesn't sit, though severity or exploitability alone can still warrant action.
Where this sits among everything scored
Of 370,894 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Real counts from FIRST.org, not a sample — log-scaled since the landscape is heavily right-skewed.
Real-World Exposure
pheditor/pheditorReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects Packagist packages — download data is not available via public APIs for these ecosystems.
Description
Summary
Pheditor 2.0.4 has an authenticated terminal command whitelist bypass.
The terminal feature checks whether the submitted command starts with one of the configured TERMINAL_COMMANDS values, then passes the full command string to shell_exec(). Shell command substitution such as $() is not blocked, so an authenticated user with the terminal permission can bypass a restricted command allowlist and execute arbitrary shell commands as the web server user.
Details
Tested repository:
https://github.com/pheditor/pheditor
Tested commit:
62b43df7cb8956a9b0deb9bec278ca8676c890c5
Affected version:
Pheditor 2.0.4
Relevant code in pheditor.php:
- The terminal handler receives
$_POST['command']and stores it in$command. - It blocks only
&,;, and||. - It checks whether
$commandstarts with one of the configured values inTERMINAL_COMMANDS. - It then passes the full command string to
shell_exec().
Relevant logic:
$command = $_POST['command'];
if (strpos($command, '&') !== false || strpos($command, ';') !== false || strpos($command, '||') !== false) {
echo json_error("Illegal character(s) in command (& ; ||)\n");
exit;
}
foreach ($terminal_commands as $value) {
$value = trim($value);
if (strlen($command) >= strlen($value) && substr($command, 0, strlen($value)) == $value) {
$command_found = true;
break;
}
}
$output = shell_exec((empty($dir) ? null : 'cd ' . escapeshellarg($dir) . ' && ') . $command . ' && echo \ ; pwd');
Because the whitelist check is prefix-based and the full command is executed by a shell, a command such as ls$(...) passes when ls is allowed, while the command substitution is still executed by the shell.
PoC
This was reproduced locally with Docker and PHP 8.3.
For a strict test, the configured command allowlist was changed to only allow ls:
define('TERMINAL_COMMANDS', 'ls');
Control request:
command=whoami
Observed result:
Command not allowed
Available commands:
ls
Bypass request:
command=ls$(printf pheditor-terminal-bypass >/lab/app/site/proof.txt)
Observed result:
proof.txt is created with the content:
pheditor-terminal-bypass
This shows that even when only ls is allowed, arbitrary shell commands can still be executed through command substitution.
Impact
An authenticated user with the terminal permission can bypass the intended TERMINAL_COMMANDS restriction and execute arbitrary shell commands as the web server user.
This affects deployments where administrators rely on TERMINAL_COMMANDS to restrict terminal access to a small set of safe commands.
Suggested fixes:
- Avoid passing user-controlled command strings to
shell_exec(). - Parse the command into executable and arguments.
- Require an exact command name match instead of prefix matching.
- Execute without a shell, for example with an argument-array based process API.
- If shell execution remains necessary, reject shell metacharacters comprehensively, including command substitution syntax.
- Consider disabling the terminal feature by default.
Reporter credit requested:
shanjijian [email protected]
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐘Packagist | pheditor/pheditor | all versions | 2.0.5 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for pheditor/pheditor. O3's reachability analysis confirms whether the vulnerable code path is actually invoked in your application, so you act on real exposure instead of every transitive match.
Fix
Update pheditor/pheditor to 2.0.5 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-9643-6xjp-vx57 is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
How O3 protects you
O3 pinpoints whether GHSA-9643-6xjp-vx57 is reachable in your code and exactly where to fix it, then blocks exploitation in production at runtime until the patched version is deployed.
Tailored to GHSA-9643-6xjp-vx57. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.
Frequently Asked Questions
Is GHSA-9643-6xjp-vx57 in your dependencies?
O3 detects GHSA-9643-6xjp-vx57 across Packagist dependencies and uses function-level reachability to confirm whether the vulnerable code path is actually reachable — not just present. No false positives.