Summary
goshs versions 2.0.0-beta.4 through 2.0.0-beta.5 expose state-changing HTTP GET routes (such as ?delete and ?mkdir) without CSRF protection.
An external site can trick a user's already authenticated browser into sending these requests, allowing destructive file operations without the user's intent.
Affected context
This vulnerability appears in goshs deployments that:
- Use HTTP basic authentication in the browser for access control
- Expose file-management actions (e.g., create directory, delete) via HTTP GET query parameters like
?deleteand?mkdir - Are reachable from users who browse other, potentially malicious websites while still authenticated to goshs
The issue manifests when the application trusts any authenticated GET request as intentional, without validating its origin or the user's explicit interaction.
Exploit preconditions
- Attack surface: Web interface of goshs, specifically state-changing GET endpoints.
- Required access:
- Attacker must be able to serve or inject HTML/JavaScript that the victim's browser can load.
- Victim must be authenticated to goshs via HTTP Basic Auth and have an active session or cached credentials.
- Trigger point: Victim visits a malicious or compromised site that silently issues GET requests (e.g., via
<img>,<link>, or automatic navigation) to goshs endpoints such as?deleteor?mkdir. - Why exploitation is possible: goshs:
- Relies solely on HTTP basic authentication, which the browser automatically reuses.
- Does not implement CSRF tokens or same-site checks.
- Does not enforce Origin or Referer validation on sensitive routes.
Why this happens
The root cause is the absence of anti-CSRF controls on state-changing endpoints combined with the use of HTTP GET for destructive actions.
Browsers automatically include stored basic-auth credentials in cross-origin requests, so any site can induce a user's browser to send authenticated requests if the target server does not verify the request's origin or user intent.
This maps to CWE-352: Cross-Site Request Forgery (CSRF), where an application accepts authenticated requests from a user's browser without ensuring that those requests were deliberately initiated by that user within the trusted origin.
Potential impact
- Unauthorized deletion of files or directories accessible through goshs
- Unauthorized creation of directories or other file system modifications
- Disruption or loss of hosted content served by goshs
- Facilitation of further attacks if file operations can modify configuration or upload malicious content
- Damage to data integrity and availability within the served directory tree
General mitigation guidance
Effective mitigation focuses on treating state-changing operations as sensitive and verifying user intent and request origin:
- Prefer non-idempotent HTTP methods (POST/PUT/DELETE) for state-changing actions instead of GET, and treat them as protected endpoints.
- Introduce CSRF tokens for all operations that mutate state; validate tokens server-side for each such request.
- Enforce strict Origin and/or Referer header checks for sensitive routes, rejecting requests that do not originate from allowed origins.
- Apply the principle of least privilege at the file-system level so that the goshs process only has access to the minimal required directory tree.
- Consider time-bounded or per-action authentication prompts for highly destructive operations (e.g., bulk delete) rather than relying only on long-lived basic auth.
- Encourage deployment behind an authenticated reverse proxy or gateway that can enforce CSRF-aware policies if application-level changes are limited.
How teams detect issues like this
Organizations and maintainers can detect similar CSRF issues using:
- Static analysis and code review:
- Flag state-changing logic reachable via HTTP GET or without CSRF token verification.
- Identify sensitive endpoints that do not check Origin/Referer headers.
- Look for reliance solely on HTTP basic authentication without additional request-context validation.
- Security testing:
- Perform manual penetration tests or automated web scans that attempt cross-origin requests to sensitive endpoints.
- Use browser-based testing tools to simulate cross-site requests from untrusted domains.
- Process and policy checks:
- Enforce secure coding guidelines mandating CSRF protections on all state-changing endpoints.
- Integrate automated checks in CI to detect routes lacking CSRF defenses or misusing HTTP methods for state changes.

