/

CVE-2026-40885

Severity:

HIGH RISK

(8.8)

Sensitive Information Exposure in goshs Protected Folders

CVE-2026-40885

Analyzed

Vulnerability type

Category:

Sensitive Information Exposure

CWE:

CWE-200

Impact:

Unauthorized Access and Data Manipulation

Severity:

HIGH RISK

(8.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

goshs, a Go-based SimpleHTTPServer, exposes file-based ACL credentials through its public collaborator feed when deployed without global basic authentication.

Because requests to .goshs-protected folders are logged and broadcast before authorization is enforced, an unauthenticated observer can capture and replay folder-specific Authorization headers to gain full access to the protected subtree.

Affected context

This vulnerability affects goshs deployments that:

  • Run versions between 2.0.0-beta.4 and 2.0.0-beta.5
  • Use .goshs-protected folders with folder-specific basic authentication
  • Expose the collaborator websocket/feed to unauthenticated observers
  • Do not enforce a global basic-auth gate in front of the entire server

In these conditions, request metadata for protected paths is logged and shared before access control checks complete.

Exploit preconditions

  • Attack surface: Public collaborator websocket/feed and HTTP interface of goshs
  • Required access: Network access to the goshs instance; no prior authentication needed when global basic auth is disabled
  • Trigger point: A legitimate user accesses a .goshs-protected folder using basic auth; their request is logged
  • Why exploitation is possible: The server logs and broadcasts raw request headers, including Authorization, before authorization decisions, allowing passive observers to capture reusable credentials

Why this happens

The core issue is a logging and broadcast design that treats sensitive request metadata as non-sensitive event data.

goshs records incoming HTTP requests to .goshs-protected folders and emits them over a collaborator websocket before enforcing authorization and without scrubbing confidential headers.

This aligns with CWE-200: Exposure of Sensitive Information to an Unauthorized Actor, where confidential data (here, basic-auth credentials) is unintentionally disclosed through diagnostic or collaboration channels due to insufficient separation between security-sensitive state and observability features.

Potential impact

  • Unauthorized reading of files within .goshs-protected subtrees
  • Uploading or overwriting files inside protected folders
  • Deleting files in protected directories, potentially causing data loss
  • Leveraging compromised credentials for further lateral movement within the same server context
  • Undermining trust in folder-level access control configurations

General mitigation guidance

Effective mitigation generally centers on preventing sensitive data from being exposed via observability or collaboration features and reducing trust in reusable credentials:

  • Ensure that logging and real-time feeds never include raw Authorization headers or other secrets; apply systematic header redaction
  • Enforce authorization checks before emitting request-related events to any shared channel
  • Treat collaborator or monitoring channels as potentially untrusted audiences and minimize the data shared through them
  • Favor short-lived or scoped credentials for folder access to reduce the usefulness of any intercepted headers
  • Apply a defense-in-depth model by placing stronger, centralized authentication (such as a global gate) in front of fine-grained ACLs where appropriate

How teams detect issues like this

Identifying this class of issue typically involves:

  • Reviewing code paths where HTTP request metadata is logged or broadcast, and flagging any inclusion of Authorization or credential-like headers
  • Using static analysis or custom linters to detect logging of security-sensitive headers or tokens
  • Auditing websocket or event-stream implementations to ensure authorization checks happen before event emission and that events contain only minimally necessary data
  • Implementing security-focused code review checklists that explicitly cover logging and observability channels for secret leakage
  • Applying runtime monitoring to detect anomalous or repeated use of the same basic-auth headers from different clients or IP addresses

Sources

SourceLink
github.comgithub.com/patrickhener/goshs/security/advisories/GHSA-7h3j-592v-jcrp

Frequently asked

questions

Exploitation is possible wherever the collaborator websocket/feed is reachable without strong authentication and .goshs-protected folders are in use; any observer on that channel can harvest and replay credentials.

The attacker needs only network-level access to the goshs instance and the ability to subscribe to the collaborator feed; they do not need valid credentials initially when global basic auth is not enforced.

The most robust approach is to ensure that any logging or streaming of request data strips or omits sensitive headers, and that events are only emitted after successful authorization checks, with collaborator feeds treated as untrusted audiences.

Adopt a policy that treats all observability and collaboration outputs as public by default, implement systematic redaction of secrets, integrate checks for sensitive-data logging into code review and static analysis, and design access-control workflows so that no security-sensitive data is processed by side channels before authorization completes.

Find out what's already
exploitable in your codebase.