CVE-2026-40876: CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') in patrickhener goshs
CVE-2026-40876 is a path traversal vulnerability in patrickhener goshs, a SimpleHTTPServer written in Go. Versions prior to 2. 0. 0-beta. 6 improperly validate SFTP paths using a prefix-based check, allowing authenticated SFTP users to escape the intended root jail. This enables reading and writing files outside the configured SFTP root directory, potentially exposing or modifying unrelated server files. The issue arises because the path validation does not correctly enforce directory boundaries, allowing sibling directories with similar prefixes to bypass restrictions. This vulnerability has a high severity score of 8. 7 and is fixed in version 2. 0.
AI Analysis
Technical Summary
The goshs SFTP subsystem routes file operations through handlers relying on sanitizePath(), which uses a raw string-prefix comparison for path validation. This flawed approach allows paths like /tmp/goshsroot_evil/secret.txt to pass validation when the root is /tmp/goshsroot, enabling an authenticated user to escape the SFTP root jail. The vulnerability affects all goshs versions before 2.0.0-beta.6 and is categorized as CWE-22 (Improper Limitation of a Pathname to a Restricted Directory).
Potential Impact
An authenticated SFTP user can read and write files outside the configured SFTP root directory, breaking the intended jail boundary. This can lead to unauthorized exposure or modification of unrelated server files, potentially compromising server integrity and confidentiality.
Mitigation Recommendations
This vulnerability is fixed in goshs version 2.0.0-beta.6. Users should upgrade to this version or later to remediate the issue. No official patch or temporary fix is indicated beyond upgrading. Patch status is not explicitly confirmed in vendor advisories, so users should verify with the official goshs project for the latest remediation guidance.
CVE-2026-40876: CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') in patrickhener goshs
Description
CVE-2026-40876 is a path traversal vulnerability in patrickhener goshs, a SimpleHTTPServer written in Go. Versions prior to 2. 0. 0-beta. 6 improperly validate SFTP paths using a prefix-based check, allowing authenticated SFTP users to escape the intended root jail. This enables reading and writing files outside the configured SFTP root directory, potentially exposing or modifying unrelated server files. The issue arises because the path validation does not correctly enforce directory boundaries, allowing sibling directories with similar prefixes to bypass restrictions. This vulnerability has a high severity score of 8. 7 and is fixed in version 2. 0.
CVSS v4.0
Score 8.7high
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The goshs SFTP subsystem routes file operations through handlers relying on sanitizePath(), which uses a raw string-prefix comparison for path validation. This flawed approach allows paths like /tmp/goshsroot_evil/secret.txt to pass validation when the root is /tmp/goshsroot, enabling an authenticated user to escape the SFTP root jail. The vulnerability affects all goshs versions before 2.0.0-beta.6 and is categorized as CWE-22 (Improper Limitation of a Pathname to a Restricted Directory).
Potential Impact
An authenticated SFTP user can read and write files outside the configured SFTP root directory, breaking the intended jail boundary. This can lead to unauthorized exposure or modification of unrelated server files, potentially compromising server integrity and confidentiality.
Mitigation Recommendations
This vulnerability is fixed in goshs version 2.0.0-beta.6. Users should upgrade to this version or later to remediate the issue. No official patch or temporary fix is indicated beyond upgrading. Patch status is not explicitly confirmed in vendor advisories, so users should verify with the official goshs project for the latest remediation guidance.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-04-15T15:57:41.718Z
- Cvss Version
- 4.0
- State
- PUBLISHED
- Remediation Level
- null
Threat ID: 69e7d78519fe3cd2cdf5b319
Added to database: 4/21/2026, 8:01:09 PM
Last enriched: 4/29/2026, 11:42:06 AM
Last updated: 6/5/2026, 4:03:26 PM
Views: 46
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.
External Links
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.