Skip to main content

CVE-2026-54540 — Vulnerability in pheditor/pheditor — CVE Details

HIGH

Pheditor has an authenticated terminal command whitelist bypass

Published July 16, 2026Updated July 28, 2026Source: OSV

What Should I Do?

Address in Next Maintenance Window

Low exploitation probability (0.73%). Schedule for your next planned update.

Does your project use an affected pheditor/pheditor version?

Paste your composer.lock to check it for CVE-2026-54540 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.

Check my composer.lock

Summary

Summary

Pheditor 2.0.4 has an authenticated terminal command whitelist bypass.

The terminal feature checks whether the submitted command starts with one of the configured TERMINAL_COMMANDS values, then passes the full command string to shell_exec(). Shell command substitution such as $() is not blocked, so an authenticated user with the terminal permission can bypass a restricted command allowlist and execute arbitrary shell commands as the web server user.

Details

Tested repository:

https://github.com/pheditor/pheditor

Tested commit:

62b43df7cb8956a9b0deb9bec278ca8676c890c5

Affected version:

Pheditor 2.0.4

Relevant code in pheditor.php:

  • The terminal handler receives $_POST['command'] and stores it in $command.
  • It blocks only &, ;, and ||.
  • It checks whether $command starts with one of the configured values in TERMINAL_COMMANDS.
  • It then passes the full command string to shell_exec().

Relevant logic:

$command = $_POST['command'];

if (strpos($command, '&') !== false || strpos($command, ';') !== false || strpos($command, '||') !== false) {
    echo json_error("Illegal character(s) in command (& ; ||)\n");
    exit;
}

foreach ($terminal_commands as $value) {
    $value = trim($value);

    if (strlen($command) >= strlen($value) && substr($command, 0, strlen($value)) == $value) {
        $command_found = true;
        break;
    }
}

$output = shell_exec((empty($dir) ? null : 'cd ' . escapeshellarg($dir) . ' && ') . $command . ' && echo \ ; pwd');

Because the whitelist check is prefix-based and the full command is executed by a shell, a command such as ls$(...) passes when ls is allowed, while the command substitution is still executed by the shell.

PoC

This was reproduced locally with Docker and PHP 8.3.

For a strict test, the configured command allowlist was changed to only allow ls:

define('TERMINAL_COMMANDS', 'ls');

Control request:

command=whoami

Observed result:

Command not allowed
Available commands:
ls

Bypass request:

command=ls$(printf pheditor-terminal-bypass >/lab/app/site/proof.txt)

Observed result:

proof.txt is created with the content:
pheditor-terminal-bypass

This shows that even when only ls is allowed, arbitrary shell commands can still be executed through command substitution.

Impact

An authenticated user with the terminal permission can bypass the intended TERMINAL_COMMANDS restriction and execute arbitrary shell commands as the web server user.

This affects deployments where administrators rely on TERMINAL_COMMANDS to restrict terminal access to a small set of safe commands.

Suggested fixes:

  • Avoid passing user-controlled command strings to shell_exec().
  • Parse the command into executable and arguments.
  • Require an exact command name match instead of prefix matching.
  • Execute without a shell, for example with an argument-array based process API.
  • If shell execution remains necessary, reject shell metacharacters comprehensively, including command substitution syntax.
  • Consider disabling the terminal feature by default.

Reporter credit requested:

shanjijian shanjijian@gmail.com

Advisory Timeline

  • First published July 16, 2026 (133 days ago).
  • Last revised July 28, 2026 — 11 days after initial publication.

Remediation

Upgrade to the fixed version using your package manager.

Composer
Update pheditor/pheditor to 2.0.5 or later
composer require "pheditor/pheditor:^2.0.5"

After upgrading, scan your dependencies again to confirm the vulnerability is resolved.

Affected Packages (1)

Affects 1 ecosystem: Packagist (1).

PackageFixed In
pheditor/pheditor Packagist · Affected: 2.0.0, 2.0.1, 2.0.2, 2.0.3 (+1 more)2.0.5

Vulnerability Classification

Common Weakness Enumeration (CWE) identifiers for this vulnerability type.

  • CWE-78
    OS Command InjectionMITRE

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 8.8 score means for each attack dimension.

Attack Vector
Network
Attack Complexity
Low
Privileges Required
Low
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Frequently Asked Questions

What is CVE-2026-54540?
Pheditor has an authenticated terminal command whitelist bypass. This vulnerability has been assigned a severity rating of HIGH (CVSS score: 8.8/10).
How do I check if my project is affected by CVE-2026-54540?
CVE-2026-54540 affects pheditor/pheditor. It has a 0.7% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-54540 and 200,000+ other known vulnerabilities.

Severity & Exploitability

CVSS Score
8.8

Significant impact if exploited, or exploitable with modest effort.

EPSS Score (30-day exploit probability)
0.73%
EPSS percentile: 50.4

This is an above-median EPSS score — 50.4% of tracked vulnerabilities score at or below it, putting its exploitation likelihood in the upper half of the tracked corpus.

Also Known As

GHSA-9643-6xjp-vx57

Related CVEs

  • CVE-2026-48030
    CRITICAL

    Pheditor: OS Command Injection in terminal handler via unsanitized 'dir' parameter

  • CVE-2026-55579
    CRITICAL

    Pheditor: Hardcoded default password 'admin' with no forced change enables full application compromise

  • CVE-2026-103035
    HIGH

    TeamPass folder re-parenting authorization bypass

  • CVE-2026-110782
    HIGH

    SAML2: Incomplete fix of CVE-2026-49283: unsigned embedded Response bypasses HTTP-Artifact signature verification (no embedded-Issuer binding)

  • CVE-2026-55578
    HIGH

    Pheditor: Incomplete command sanitization in terminal feature allows RCE via pipe operator, backtick substitution, and newline injection

Check your own dependencies

Free, with no signup for up to 10 packages.

Check my composer.lock