{"answers":{"affected":"2 open source packages ship an affected version, including pheditor/pheditor.","exploited":"There is no known exploitation of GHSA-g3hq-hphg-8fhh in the wild and no public exploit code.","fix":"Upgrade pheditor/pheditor to 2.0.7 or later.","what":"GHSA-g3hq-hphg-8fhh is a command injection vulnerability in pheditor/pheditor, published on 24 Jul 2026. Any signed-in user can exploit it over the network, with no action from the victim."},"fix_prompt":"Check this codebase for GHSA-g3hq-hphg-8fhh and fix it if it is affected.\n\nWhat it is: GHSA-g3hq-hphg-8fhh is a command injection vulnerability in pheditor/pheditor, published on 24 Jul 2026. Any signed-in user can exploit it over the network, with no action from the victim.\nExploitation: There is no known exploitation of GHSA-g3hq-hphg-8fhh in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- pheditor/pheditor (Packagist): affected all versions; fixed in 2.0.7\n- pheditor/pheditor (Packagist): affected all versions; fixed in 2.0.7\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/GHSA-g3hq-hphg-8fhh/ (Markdown: https://insights.sbomify.com/GHSA-g3hq-hphg-8fhh/index.md)","id":"GHSA-g3hq-hphg-8fhh","markdown":"https://insights.sbomify.com/GHSA-g3hq-hphg-8fhh/index.md","name":"GHSA-g3hq-hphg-8fhh","record":{"aliases":[],"analysis":{"component_type":"web_application","fix_type":"patch","impacts":["code_execution"],"network_reachable":"yes","non_default_config":false,"product_category":"Pheditor CMS","requires_auth":"low_privilege","summary":"Attackers can execute arbitrary commands by injecting arguments into allowlisted binaries, bypassing terminal restrictions in Pheditor.","user_interaction":"not_required","vuln_class":"command_injection"},"analysis_generated_by":"qwen3.8-flash-next","assigner":null,"cpe":[],"cvss":{"score":null,"severity":null,"source":null,"vector":null,"version":null},"cwes":[],"description":"### Summary\n\npheditor'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.\n\n### Relationship to the prior terminal advisories (this is a surviving, distinct vector)\n\nThe 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.\n\n### Root cause (HEAD, v2.0.6)\n\nIn the `terminal` action handler of `pheditor.php`:\n1. `:588` rejects `\u0026`, `;`, `|`, `$`, backtick, `\\n`, `\\r`. It does NOT reject space, `-`, `{`, `}`, `+`, `/`, `.`.\n2. `:595-605` checks the command against `TERMINAL_COMMANDS` (defined `:25`: `ls,...,php,...,git,find,grep,...,tar,...,composer,exit`) using a PREFIX match: `strlen($command) \u003e= strlen($value) \u0026\u0026 substr($command, 0, strlen($value)) == $value`. There is no word boundary and no validation of the arguments that follow.\n3. `:617` runs the command through the shell unchanged: `shell_exec((empty($dir) ? null : 'cd ' . escapeshellarg($dir) . ' \u0026\u0026 ') . $command . ' \u0026\u0026 echo \\ ; pwd')`.\n\nSo a command beginning with an allowlisted binary, carrying a code-exec flag, and containing none of the rejected characters reaches `shell_exec` intact.\n\n### Proof of concept (reproduced)\n\nPOST to the terminal action with:\n  command = `find . -maxdepth 0 -exec touch /tmp/PWNED {} +`\n  dir = (any)\n\nThis 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\" .`.\n\n### Impact\n\nArbitrary 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.\n\n### Remediation\n\nValidate 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.\n\nCredit: anir0y (independent security research).","ecosystems":["Packagist"],"exploits":{"exploitdb":null,"first_seen":null,"github_poc":null,"max_poc_stars":null,"metasploit":null,"nuclei":null,"refs":[],"tier":null},"has_fix":true,"headline":"pheditor's terminal feature restricts callers to an allowlist of commands (`TERMINAL_COMMANDS`) and rejects shell metacharacters.","id":"GHSA-g3hq-hphg-8fhh","indexable":true,"kev":null,"kind":"advisory","links":{"ecosystem":"Packagist","product":null,"products":[],"type":"command_injection","year":"2026"},"n_packages":2,"n_references":null,"packages":[{"ecosystem":"Packagist","fixed":["2.0.7"],"introduced":["0"],"last_affected":[],"package":"pheditor/pheditor","purl":null,"source":"GHSA-g3hq-hphg-8fhh"},{"ecosystem":"Packagist","fixed":["2.0.7"],"introduced":["0"],"last_affected":[],"package":"pheditor/pheditor","purl":"pkg:composer/pheditor/pheditor","source":"GHSA-g3hq-hphg-8fhh"}],"products":null,"published":"2026-07-24","related":[],"sources":[{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"}],"ssvc":{"automatable":null,"exploitation":null,"technical_impact":null},"state":null,"updated":null,"vendors":null},"summary":"Attackers can execute arbitrary commands by injecting arguments into allowlisted binaries, bypassing terminal restrictions in Pheditor.","url":"https://insights.sbomify.com/GHSA-g3hq-hphg-8fhh/"}