Pheditor Terminal Handler OS Command Injection to RCE (CVE-2026-48030)
Published: 2026-11-27 • Researcher: Muslimbek Burxonov (GitHub: muslimbek-0x, commit author muslimbekburxonov)
- Severity
- Critical
- CVE
- CVE-2026-48030
- Category
- web
- Affected product
- Pheditor, a single-file PHP editor and file manager by Hamid Samak
- Affected versions
- 2.0.1 through 2.0.3 (NVD: from 2.0.1 to before 2.0.4); fixed in 2.0.4
- Disclosed
- 2026-11-27
- Patch status
- Patched
Tags
References
- https://nvd.nist.gov/vuln/detail/CVE-2026-48030
- https://github.com/pheditor/pheditor/security/advisories/GHSA-jvc5-6g7q-c843
- https://github.com/pheditor/pheditor/releases/tag/2.0.4
- https://github.com/pheditor/pheditor
- https://github.com/muslimbek-0x/CVE-2026-48030
- https://cwe.mitre.org/data/definitions/78.html
Archive entry
intelseclab/poc-archiveOn this page
Metadata
| Field | Value |
|---|---|
| Date Added | 2026-11-27 |
| Last Updated | 2026-05-28 (upstream commit b101fe588fd66611f983751a01c404e90d941233, “CVE-2026-48030: OS Command Injection in pheditor terminal handler”) |
| Author / Researcher | Muslimbek Burxonov (GitHub: muslimbek-0x, commit author muslimbekburxonov) |
| CVE / Advisory | CVE-2026-48030 |
| Category | web |
| Severity | Critical |
| CVSS Score | 9.9 (CVSSv3.1, AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H, NVD record) |
| Status | Weaponized (complete authenticated exploit that injects through the dir parameter, reads command output and confirms execution with the uid string; no successful run is published in the repository) |
| Tags | pheditor, php, command-injection, terminal, whitelist-bypass, authenticated, rce, webshell, cwe-78 |
| Related | N/A |
Affected Target
| Field | Value |
|---|---|
| Software / System | Pheditor, a single-file PHP editor and file manager by Hamid Samak |
| Versions Affected | 2.0.1 through 2.0.3 (NVD: from 2.0.1 to before 2.0.4); fixed in 2.0.4 |
| Language / Platform | PHP web application served by Apache, nginx with PHP-FPM, or the PHP built-in server; the archived PoC is Python 3 |
| Authentication Required | Yes — the Pheditor password, which by default is a single shared password and falls back to admin in the script |
| Network Access Required | Yes — HTTP/HTTPS access to pheditor.php |
Summary
Pheditor’s terminal action builds a shell command by prefixing the attacker-supplied dir parameter to the requested terminal command and passing the result to the shell execution function. The handler screens the command parameter for metacharacters but never screens dir, so a value such as /tmp; id # closes the intended cd and runs arbitrary commands of the attacker’s choosing. Because the injected command runs alongside a permitted whitelisted command, the terminal command allowlist provides no protection, and an authenticated user gains remote code execution with the web server account. The published exploit logs in, extracts the CSRF token, injects through dir, parses the command output and confirms success by looking for the uid string.
Vulnerability Details
Root Cause
In the terminal action handler of pheditor.php the request parameters are used as follows (line 586 in the vulnerable builds):
| |
The metacharacter filter covers command only, and it is applied before the allowlist check of TERMINAL_COMMANDS. dir is concatenated into the string with no escaping, so shell metacharacters in dir terminate the cd and start a new command. This is CWE-78 (Improper Neutralization of Special Elements used in an OS Command). The upstream fix wraps dir in escapeshellarg().
Attack Vector
An authenticated POST to the Pheditor endpoint with the session cookie obtained from the password login, a valid CSRF token and the terminal action:
action=terminal
token=<token from the page>
command=ls
dir=/tmp; <attacker command> #The # comments out the trailing && echo ; pwd that the handler appends, so only the attacker command runs. No administrator account, second factor or interaction is needed beyond the single Pheditor password.
Impact
Remote code execution as the web server user (www-data, apache or similar). An attacker can read and modify every file the web server can reach, exfiltrate configuration and credentials, write a PHP webshell into the document root for persistent access, pivot to the database, and use the host as a foothold in the internal network. Pheditor is often deployed with a weak or default password and exposed directly, which raises the practical impact well beyond the stated privileges-required metric.
Environment / Lab Setup
OS: Linux with PHP 7.4 or 8.x; any attacker host
Target: pheditor 2.0.1, 2.0.2 or 2.0.3 (single pheditor.php file)
Attacker: Python 3 with requests
Tools: php -S or Apache/PHP-FPM, requests, curlSetup Steps
| |
The script assumes the endpoint is http://TARGET/pheditor.php and defaults the password to admin; pass the real one with --password. For a webshell test the web server must own a writable document root, which is the normal deployment.
Proof of Concept
Step-by-Step Reproduction
Install the dependency — only
requestsis required.Shell script1python3 -m pip install requestsCheck the vulnerability — the script logs in, fetches the token and injects
idthroughdir, then looks foruid=in the output.Shell script1python3 poc.py --target http://127.0.0.1:8080/pheditor.php --password adminRun a specific command — pass it with
--cmd.Shell script1 2python3 poc.py --target http://127.0.0.1:8080/pheditor.php \ --password admin --cmd 'cat /etc/passwd'Open an interactive shell or drop a webshell — both modes reuse the same injection primitive.
Shell script1 2 3python3 poc.py --target http://127.0.0.1:8080/pheditor.php --password admin --shell python3 poc.py --target http://127.0.0.1:8080/pheditor.php \ --password admin --webshell /var/www/html
Exploit Code
See
poc.pyin this folder. The upstream README isupstream-README.md.
| |
Expected Output
| |
ZAIFLIK TASDIQLANDI is Uzbek for “vulnerability confirmed”; the remaining Uzbek strings are progress and error messages and do not affect the exploit. On a patched build the uid check fails and the script exits with [-] Zaiflik topilmadi — patch qo'llangan bo'lishi mumkin (“vulnerability not found — the patch may be applied”).
Detection & Indicators of Compromise
POST /pheditor.php action=terminal and a dir value containing ; & | ` $ ( ) or #
POST /pheditor.php with command=ls and an unusual dir such as /tmp; id #
PHP-FPM or Apache children spawning /bin/sh -c with "cd <dir> && ls"
New PHP files in the document root (for example shell.php) owned by the web user
Unexpected outbound connections from the web server
Reads of /etc/passwd, .env, config.php or SSH material by the web userBecause the request otherwise looks like a legitimate terminal call, profile the dir value rather than the action alone. Also alert on the fixed webshell name and on any new executable content under the document root.
SIEM / IDS Rule (example):
alert http any any -> any any (msg:"CVE-2026-48030 Pheditor terminal dir injection"; flow:to_server,established; content:"action=terminal"; http_client_body; content:"dir="; http_client_body; pcre:"/dir=[^&]*%3[Bb]|dir=[^&]*[;#`]/"; sid:90480300; rev:1;)Remediation
| Action | Detail |
|---|---|
| Patch | Upgrade Pheditor to 2.0.4 or later; the fix applies escapeshellarg() to the dir value before it reaches shell_exec. |
| Workaround | Remove or disable the terminal action if it is not needed, place Pheditor behind a VPN or an authenticated reverse proxy, and do not expose it to the internet. |
| Config Hardening | Set a long unique Pheditor password, serve the file over HTTPS only, run PHP with the least privilege and an open_basedir restriction, make the document root read-only for the web user where possible, and monitor the tree for new PHP files. |
References
Notes
Auto-prepared on 2026-11-27 from https://github.com/muslimbek-0x/CVE-2026-48030 (no stars at review time, one Python script plus a README).
Review verdict: ingested as Weaponized. It is a genuine end-to-end exploit, not a detector: it authenticates with the real Pheditor password form, scrapes the CSRF token from the page, sends the terminal action with a whitelisted command and a malicious dir, parses the JSON response and verifies code execution from the uid= string. It contains no C2, persistence, evasion, keylogging, mining or credential-stealing modules; the optional webshell helper writes a single one-line PHP command shell, which is a standard post-exploitation proof for this class of bug rather than a general framework.
Limitations: the repository publishes no transcript of a successful run, so Weaponized reflects the completeness of the implemented chain rather than observed output. The webshell helper is itself defective: shell_code contains single quotes around c, and the command wraps it in single quotes (echo '<php code>' > shell.php), which breaks shell quoting; the code has to be rewritten without embedded single quotes (or base64-encoded) to work. The interactive shell re-fetches a token for every command. The token regex assumes the token is lowercase hex, and the login flow assumes the default single-password mode. The target must be able to write to the supplied webroot for the webshell mode. No exploit code was executed while preparing this entry.
License: the repository declares no LICENSE file, so copyright remains with the author and no reuse rights are granted. The archived script keeps the original attribution and adds only a short research-use header; the upstream README is copied verbatim as upstream-README.md.
| |