GHSA-964w-f6gj-5236

Suggest an improvement
Source
https://github.com/advisories/GHSA-964w-f6gj-5236
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/07/GHSA-964w-f6gj-5236/GHSA-964w-f6gj-5236.json
JSON Data
https://api.test.osv.dev/v1/vulns/GHSA-964w-f6gj-5236
Aliases
Published
2026-07-28T22:26:28Z
Modified
2026-08-18T15:10:56Z
Severity
  • 5.3 (Medium) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N CVSS Calculator
Summary
goshs has ACL Bypass & Path Traversal
Details

Summary

sendFile derives the served filename from the raw request path while opening the file from the cleaned path, so appending a trailing slash empties the derived name and defeats both the never-serve rule for the ACL file and the block list.

Finding (Medium): trailing-slash ACL and hidden-file bypass

httpserver/handler.go, sendFile (lines 789-801) takes the filename from the RAW req.URL.Path while the file itself is opened from the filepath.Clean-ed path. The two disagree, and a trailing slash makes the derived name the empty string. Both protections key on that derived name, so both are defeated: the rule that never serves the .goshs ACL file, and the acl.Block list.

Measured, with negative controls:

GET /blocked/secret.txt    -> 404          (control, correctly blocked)
GET /blocked/secret.txt/   -> 200 + contents
GET /blocked/.goshs/       -> 200, returns the ACL file itself,
                              including the admin:$2a$... bcrypt hash

Unauthenticated when the ACL is configured block-only (common usage). Stated precisely: AUTHENTICATION IS NOT BYPASSED. An unauthenticated request against a directory protected by authentication still returns 401 under the same trick; I tested that. The claim is specifically that the block list and the ACL-file protection are bypassed. In-tree evidence that sendFile is the defect: the sibling handlers doDir and bulkDownload both derive the name correctly; sendFile is the lone outlier.

Suggested fixes

  1. Derive the served filename from the same cleaned path used to open the file, so the authorization decision and the file access cannot disagree.

Tooling

AI assistance was used while investigating. The finding was reproduced against a running server on loopback with negative controls, including the 404-versus-200 pair and the authenticated-directory control that shows authentication is not affected.

Database specific
{
    "cwe_ids": [
        "CWE-22",
        "CWE-41",
        "CWE-863"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-07-28T22:26:28Z",
    "nvd_published_at": null,
    "severity": "MODERATE"
}
References

Affected packages

Go / github.com/patrickhener/goshs/v2

Package

Name
github.com/patrickhener/goshs/v2
View open source insights on deps.dev
Purl
pkg:golang/github.com/patrickhener/goshs/v2

Affected ranges

Type
SEMVER
Events
Introduced
0 Unknown introduced version / All previous versions are affected
Fixed
2.1.5-0.20260727065949-f3ef599e4091

Database specific

last_known_affected_version_range
"<= 2.1.4"
source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/07/GHSA-964w-f6gj-5236/GHSA-964w-f6gj-5236.json"

Go / goshs.de/goshs/v2

Package

Name
goshs.de/goshs/v2
View open source insights on deps.dev
Purl
pkg:golang/goshs.de/goshs/v2

Affected ranges

Type
SEMVER
Events
Introduced
0 Unknown introduced version / All previous versions are affected
Fixed
2.1.5-0.20260727065949-f3ef599e4091

Database specific

last_known_affected_version_range
"<= 2.1.4"
source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/07/GHSA-964w-f6gj-5236/GHSA-964w-f6gj-5236.json"

Go / github.com/patrickhener/goshs

Package

Name
github.com/patrickhener/goshs
View open source insights on deps.dev
Purl
pkg:golang/github.com/patrickhener/goshs

Affected ranges

Type
SEMVER
Events
Introduced
0 Unknown introduced version / All previous versions are affected
Last Affected
1.1.4

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/07/GHSA-964w-f6gj-5236/GHSA-964w-f6gj-5236.json"

Go / goshs.de/goshs

Package

Name
goshs.de/goshs
View open source insights on deps.dev
Purl
pkg:golang/goshs.de/goshs

Affected ranges

Type
SEMVER
Events
Introduced
0 Unknown introduced version / All previous versions are affected
Last Affected
1.1.4

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/07/GHSA-964w-f6gj-5236/GHSA-964w-f6gj-5236.json"