Your RSA-2048 keys break in 2030. Find every one of them before attackers do.
🐘
🐘 Packagist
Not in CISA KEV
HIGH severity

GHSA-g3hq-hphg-8fhh

HIGHFix: pheditor/pheditor@f40f507

GHSA-g3hq-hphg-8fhh is a high-severity (CVSS 8.8) remote code execution vulnerability in pheditor/pheditor. O3 Security confirms whether GHSA-g3hq-hphg-8fhh is actually reachable in your code before you act, and blocks exploitation at runtime until you patch.

Pheditor: Terminal command-allowlist bypass via argument injection leads to RCE — surviving vector after the metacharacter-sanitization fixes

Published
Jul 24, 2026
Updated
Jul 24, 2026
Affected
1 pkg
Patched
1 / 1
Exploits
None indexed
Exploitation data as of Jul 24, 2026 · OSV.dev, FIRST.org (EPSS)

Real-World Exposure

1 pkg affected
🐘pheditor/pheditor

Real-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'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:

  1. :588 rejects &, ;, |, $, backtick, \n, \r. It does NOT reject space, -, {, }, +, /, ..
  2. :595-605 checks the command against TERMINAL_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.
  3. :617 runs 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.

Remediation

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).

Affected Packages

1 total 1 fixed
EcosystemPackageVulnerable rangeFix
🐘Packagistpheditor/pheditorall versions2.0.7

Detection & mitigation playbook

Open-source dependency
  1. Detect

    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.

  2. Fix

    Update pheditor/pheditor to 2.0.7 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-g3hq-hphg-8fhh is resolved across your whole dependency graph.

  3. 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.

  4. How O3 protects you

    O3 pinpoints whether GHSA-g3hq-hphg-8fhh 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-g3hq-hphg-8fhh. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.

Frequently Asked Questions

### Summary 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, di
O3 Security · Impact-Aware SCA

Is GHSA-g3hq-hphg-8fhh in your dependencies?

O3 detects GHSA-g3hq-hphg-8fhh across Packagist dependencies and uses function-level reachability to confirm whether the vulnerable code path is actually reachable — not just present. No false positives.

GHSA-g3hq-hphg-8fhh: pheditor/pheditor… | O3 Security