Skip to main content

goshs CVE-2026-50139

| EUVDEUVD-2026-60950 MEDIUM
Race Condition (CWE-362)
2026-07-01 https://github.com/patrickhener/goshs GHSA-j48m-h7xq-2xpj
5.9
CVSS 3.1 · Vendor: https://github.com/patrickhener/goshs
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Obtain valid share-link token via disclosure
  2. Delivery
    Send parallel GET requests to /?token=<token>
  3. Exploit
    Concurrent goroutines race through TOCTOU window
  4. Execution
    All requests pass pre-increment limit check
  5. Impact
    Files served beyond configured download cap

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A06:2025 - Insecure Design
ASVS 5.0
V15 - Secure Coding and Architecture Concurrency control, locking
MITRE ATT&CK

1 technique across 1 tactic: Privilege Escalation

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitation requires three concrete conditions: (1) the goshs instance has the share-link feature in use and at least one token has been issued with a non-zero DownloadLimit - tokens with no limit (DownloadLimit == -1) are unaffected by this race since the bypass is only meaningful when a cap is intended; (2) the attacker possesses a valid, unexpired share token - this is the primary prerequisite and is not granted by this vulnerability itself; (3) the attacker can dispatch two or more concurrent HTTP requests within the file-transfer window, which widens naturally with larger files. No authentication to the goshs server is required once the token is known (PR:N per CVSS), and no special client tooling beyond standard HTTP is needed. What limits exploitation: the attacker must have obtained the token through a prior disclosure channel; goshs is typically deployed on local or trusted networks, reducing the default exposure surface; the race window, while practically exploitable, does introduce a timing dependency (AC:H per CVSS) that could fail under high-latency or rate-limited network paths.

Impact

The vendor-assigned CVSS 3.1 score of 5.9 Medium (AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N) is consistent with the technical facts. AC:H reflects that successful exploitation requires concurrent HTTP requests timed within the same TOCTOU window; however, the included POC demonstrates 5/5 reliable reproduction with only two parallel curl processes, suggesting the race window is wide enough to be readily won in practice - AC:H may overstate the real-world difficulty. The vulnerability is not in CISA KEV, indicating no confirmed widespread active exploitation at the time of analysis. EPSS data is not present in the provided intelligence and cannot be estimated here. The primary gating factor for real-world risk is token possession: an attacker must first obtain a valid, unexpired share token before the race is meaningful. For operators using goshs to distribute one-shot secrets (credentials, signing keys, sensitive documents) under the assumption that limit=1 provides a hard delivery guarantee, this race condition represents a significant control failure - the intended single-use property is entirely defeated. Risk is further bounded by goshs's typical deployment profile as a personal or small-team tool rather than a large-scale enterprise service.

Exploit ScenarioDerived

An attacker who obtains a valid goshs share token - through email interception, browser history exposure, or a forwarded link - issues two or more simultaneous HTTP GET requests to /?token=<token> using parallel HTTP clients (e.g., background curl processes). All requests enter the TOCTOU window simultaneously, each independently reads Downloaded < DownloadLimit as true before any increment is committed, and each receives a 200 response with the full file. The publicly available POC in GHSA-j48m-h7xq-2xpj demonstrates this with two concurrent requests against a limit=1 token, achieving two successful redemptions on five consecutive attempts.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.2% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Jul 01, 2026

Download-limit enforcement in goshs (Go Simple HTTP Server) v2.0.9 and earlier can be bypassed by racing concurrent HTTP requests against a limited-use share token, allowing a single token to be redeemed more times than the operator configured. The TOCTOU flaw in ShareHandler means every concurrent goroutine observes the same pre-increment Downloaded counter, each passes the limit check, and each is served the file - completely defeating one-shot or low-count share-link controls. A working proof-of-concept is publicly documented in the GitHub security advisory (GHSA-j48m-h7xq-2xpj) with 5/5 consistent reproductions; no active exploitation is confirmed in CISA KEV.

RemediationAI

No specific patched release version is named in the available advisory data - operators should monitor the goshs GitHub repository (https://github.com/patrickhener/goshs) for a release superseding v2.0.9 that incorporates the fix described in GHSA-j48m-h7xq-2xpj. The advisory's suggested fix moves the limit check and counter increment inside a write lock before file serving begins, with a decrement path if the transfer fails - this is the correct architectural resolution. As an interim compensating control, operators should avoid using the share-link DownloadLimit feature for single-use secret distribution until the patch is applied, as the limit provides no reliable guarantee under concurrent access. A secondary workaround is to restrict network access to the goshs instance to a trusted IP range, reducing the population of concurrent clients that could race the endpoint; this reduces exposure but does not eliminate the race for clients within the allowed range. Patch availability beyond the described code change is not independently confirmed from the provided data.

Affected VersionsENISA

goshs < 2.1.0

Affected Packages

go goshs.de/goshs no fix
go goshs.de/goshs/v2 fix: 2.1.0
euvd goshs fix: 2.1.0

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 3 packages in go, euvd

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

The affected code is httpserver/handler.go lines 968-1018 in the goshs.de/goshs/v2 Go module (CPE: pkg:go/goshs.de_goshs_v2; GitHub: github.com/patrickhener/goshs). The root cause is CWE-362 - Concurrent Execution using Shared Resource with Improper Synchronization, classically described as a TOCTOU (Time-of-Check Time-of-Use) race. The SharedLinks map is protected by a sync.RWMutex, but the implementation acquires RLock only to read the current Downloaded/DownloadLimit snapshot, immediately releases it, serves the entire file transfer with no lock held, then re-acquires a write lock afterward to increment the counter. Go's HTTP server dispatches each inbound request into its own goroutine, so N concurrent requests all read the same pre-increment state, all independently satisfy the limit predicate, and all proceed to serve before any single increment is committed - making the configured cap effectively unenforceable under concurrent load.

Know when the next one hits your stack

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (https://github.com/patrickhener/goshs) PRIMARY 5.9 MEDIUM
AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N
vuln.today AI 5.9 MEDIUM

Network-accessible endpoint, token possession substitutes for no privilege requirement, race timing yields AC:H; impact is purely confidentiality with no integrity or availability consequence.

3.1 AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N
4.0 AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N
SUSE MEDIUM

Primary rating from Vendor (https://github.com/patrickhener/goshs).

CVSS VectorVendor: https://github.com/patrickhener/goshs

Attack Vector
Network
Attack Complexity
High
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
None
Availability
None

DescriptionCVE.org

Share-link ?token=… redemption races past download limit

Ecosystem: Go Package: goshs.de/goshs/v2 (github.com/patrickhener/goshs) Affected: <= v2.0.9 (every release that shipped the share-link feature)

Summary

ShareHandler reads the share token's DownloadLimit under RLock, releases the lock, serves the file, then re-acquires the lock to increment the counter. Concurrent requests all read the same Downloaded/DownloadLimit snapshot, all pass the check, and all are served - exceeding the operator's intended cap.

Details

httpserver/handler.go:968-1018:

go
fs.sharedLinksMu.RLock()
entry, ok := fs.SharedLinks[token]
fs.sharedLinksMu.RUnlock()                       // <-- released here

if entry.DownloadLimit > 0 || entry.DownloadLimit == -1 {
    // ...serve file...                          // <-- whole transfer happens unlocked
}

fs.sharedLinksMu.Lock()                          // <-- re-acquired only now
current.Downloaded++
if current.Downloaded >= current.DownloadLimit { delete(fs.SharedLinks, token) }
fs.sharedLinksMu.Unlock()

Between line 978 (RUnlock) and line 1008 (Lock), any number of goroutines can interleave and each observes the same pre-increment limit.

Proof of concept

bash
goshs -p 18000 -d /tmp/r -b admin:pw &
echo data > /tmp/r/f.txt
# operator issues a one-shot share
SHARE=$(curl -su admin:pw "http://localhost:18000/f.txt?share&limit=1")
TK=$(echo "$SHARE" | sed -n 's/.*token=\([^"]*\)".*/\1/p')
# attacker races two redemptions
curl -so /dev/null -w "%{http_code}\n" "http://localhost:18000/?token=$TK" & \
curl -so /dev/null -w "%{http_code}\n" "http://localhost:18000/?token=$TK" & \
wait
# observed: 200 / 200 (both succeed) -> limit=1 redeemed twice

Reproduced 5/5 times in a row on a 2026-era M-series Mac during verification.

Impact

A "single-use" share intended to deliver a one-shot secret can be redeemed N times by N concurrent clients. Combined with any token-leak vector (mail forwarding, browser history, intercepted link, etc.) this multiplies the exfiltration window.

Suggested fix

Reserve under the write lock *before* serving - refund only if the serve fails:

go
fs.sharedLinksMu.Lock()
entry, ok := fs.SharedLinks[token]
if !ok || time.Now().After(entry.Expires) ||
   (entry.DownloadLimit != -1 && entry.Downloaded >= entry.DownloadLimit) {
    fs.sharedLinksMu.Unlock(); http.NotFound(w, r); return
}
entry.Downloaded++
if entry.DownloadLimit != -1 && entry.Downloaded >= entry.DownloadLimit {
    delete(fs.SharedLinks, token)
} else {
    fs.SharedLinks[token] = entry
}
fs.sharedLinksMu.Unlock()
// ...serve...

Add a regression test that races two requests against a limit=1 token and asserts exactly one 200.

Reporter: Nishant Verma. Reproduced against goshs v2.0.9 (commit 8fc1e91) on 2026-05-27.

Threat Intelligence Overview

EPSS Score
0.2%
Top 84% exploitable
Prevalence
Low
niche developer file-sharing CLI tool, limited enterprise deployment
Threat Intel
1
1 source
Data Quality
6 sources
Confidence: High

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.2%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
None
System Exposure· derived
Open
Automatable· derived
No
Human Impact· derived
Medium

Priority Score

30
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +30
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.

Race conditions occur when multiple concurrent requests exploit the brief time gap between checking a condition and acting upon it (TOCTOU - Time of Check, Time of Use).

Vendor StatusVendor

SUSE

Severity: Moderate
Product Status
SUSE Linux Enterprise Server 16.1 Affected
SUSE Linux Enterprise Server for SAP applications 16.1 Affected
SUSE Linux Enterprise Module for Package Hub 15 SP5 Affected
SUSE Linux Enterprise Module for Package Hub 15 SP6 Affected
openSUSE Leap 15.5 Affected

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy