GHSA-j48m-h7xq-2xpj: goshs: Share-link ?token=… redemption races past download limit
The goshs Go package (<= v2.0.9) contains a race condition in its share-link token redemption logic. Concurrent requests can bypass the intended download limit by reading the download count without proper synchronization, allowing multiple redemptions of a single-use share link. This flaw arises because the download count is checked under a read lock but incremented later under a write lock, enabling race conditions. The issue allows an attacker with access to a share token to download the shared file multiple times beyond the operator's intended limit.
AI Analysis
Technical Summary
In goshs versions up to 2.0.9, the ShareHandler uses a read lock to check the DownloadLimit and Downloaded count, then releases the lock before serving the file. After serving, it reacquires a write lock to increment the Downloaded count and potentially delete the share link if the limit is reached. This sequence allows concurrent goroutines to observe the same Downloaded count and all pass the limit check, resulting in multiple downloads exceeding the intended cap. The vulnerability is a classic race condition (CWE-362) in concurrent access to shared state. A proof of concept demonstrates that two concurrent requests can both succeed on a single-use token. The suggested fix is to acquire the write lock before serving, increment the counter, and only serve if the limit is not exceeded, refunding the increment if serving fails.
Potential Impact
An attacker or multiple concurrent clients can redeem a share link token more times than the configured download limit, effectively bypassing the single-use or limited-use restriction. This increases the risk of unauthorized data exfiltration if the token is leaked or intercepted, as the intended one-time or limited access control is circumvented. The impact is limited to confidentiality as the integrity and availability are not affected.
Mitigation Recommendations
Patch status is not yet confirmed — check the vendor advisory for current remediation guidance. The recommended fix is to modify the code to acquire the write lock before serving the file, increment the download count under this lock, and only proceed if the limit is not exceeded. If serving fails, the increment should be refunded. Until a patch is available, users should avoid using the share-link feature with download limits or implement external synchronization to prevent concurrent access. No official fix or patch links are currently provided.
GHSA-j48m-h7xq-2xpj: goshs: Share-link ?token=… redemption races past download limit
Description
The goshs Go package (<= v2.0.9) contains a race condition in its share-link token redemption logic. Concurrent requests can bypass the intended download limit by reading the download count without proper synchronization, allowing multiple redemptions of a single-use share link. This flaw arises because the download count is checked under a read lock but incremented later under a write lock, enabling race conditions. The issue allows an attacker with access to a share token to download the shared file multiple times beyond the operator's intended limit.
CVSS v3.1
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
In goshs versions up to 2.0.9, the ShareHandler uses a read lock to check the DownloadLimit and Downloaded count, then releases the lock before serving the file. After serving, it reacquires a write lock to increment the Downloaded count and potentially delete the share link if the limit is reached. This sequence allows concurrent goroutines to observe the same Downloaded count and all pass the limit check, resulting in multiple downloads exceeding the intended cap. The vulnerability is a classic race condition (CWE-362) in concurrent access to shared state. A proof of concept demonstrates that two concurrent requests can both succeed on a single-use token. The suggested fix is to acquire the write lock before serving, increment the counter, and only serve if the limit is not exceeded, refunding the increment if serving fails.
Potential Impact
An attacker or multiple concurrent clients can redeem a share link token more times than the configured download limit, effectively bypassing the single-use or limited-use restriction. This increases the risk of unauthorized data exfiltration if the token is leaked or intercepted, as the intended one-time or limited access control is circumvented. The impact is limited to confidentiality as the integrity and availability are not affected.
Mitigation Recommendations
Patch status is not yet confirmed — check the vendor advisory for current remediation guidance. The recommended fix is to modify the code to acquire the write lock before serving the file, increment the download count under this lock, and only proceed if the limit is not exceeded. If serving fails, the increment should be refunded. Until a patch is available, users should avoid using the share-link feature with download limits or implement external synchronization to prevent concurrent access. No official fix or patch links are currently provided.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- GHSA-j48m-h7xq-2xpj
- Osv Schema Version
- 1.4.0
- Aliases
- ["CVE-2026-50139"]
- Ecosystems
- ["Go"]
- Database Specific Severity
- MODERATE
- Cvss Version
- 3.1
Threat ID: 6a45998227e9c797194186cf
Added to database: 07/01/2026, 22:49:38 UTC
Last enriched: 07/01/2026, 22:49:51 UTC
Last updated: 07/01/2026, 23:12:05 UTC
Views: 4
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.