Skip to main content
Press slash or control plus K to focus the search. Use the arrow keys to navigate results and press enter to open a threat.
Reconnecting to live updates…

CVE-2026-40876: CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') in patrickhener goshs

0
High
VulnerabilityCVE-2026-40876cvecve-2026-40876cwe-22
Published: Tue Apr 21 2026 (04/21/2026, 19:34:19 UTC)
Source: CVE Database V5
Vendor/Project: patrickhener
Product: goshs

Description

goshs is a SimpleHTTPServer written in Go. Prior to 2.0.0-beta.6, goshs contains an SFTP root escape caused by prefix-based path validation. An authenticated SFTP user can read from and write to filesystem paths outside the configured SFTP root, which breaks the intended jail boundary and can expose or modify unrelated server files. The SFTP subsystem routes requests through sftpserver/sftpserver.go into DefaultHandler.GetHandler() in sftpserver/handler.go, which forwards file operations into readFile, writeFile, listFile, and cmdFile. All of those sinks rely on sanitizePath() in sftpserver/helper.go. helper.go uses a raw string-prefix comparison, not a directory-boundary check. Because of that, if the configured root is /tmp/goshsroot, then a sibling path such as /tmp/goshsroot_evil/secret.txt incorrectly passes validation since it starts with the same byte prefix. This vulnerability is fixed in 2.0.0-beta.6.

AI-Powered Analysis

Machine-generated threat intelligence

AILast updated: 04/21/2026, 20:16:40 UTC

Technical Analysis

The goshs SimpleHTTPServer's SFTP subsystem improperly limits pathname access due to prefix-based path validation in sanitizePath(). This allows an authenticated SFTP user to bypass the intended root jail by accessing filesystem paths that share the same prefix but are outside the configured root directory. For example, if the root is /tmp/goshsroot, paths like /tmp/goshsroot_evil/secret.txt are incorrectly allowed. This vulnerability affects all versions before 2.0.0-beta.6 and is classified under CWE-22 (Improper Limitation of a Pathname to a Restricted Directory).

Potential Impact

An authenticated SFTP user can read and write files outside the designated SFTP root directory, potentially exposing or modifying unrelated server files. This breaks the security boundary intended to isolate SFTP operations, leading to high confidentiality, integrity, and availability impacts as indicated by the CVSS 8.7 score.

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 workaround is provided for earlier versions. Patch status is not explicitly confirmed beyond the fixed version; therefore, verify with the vendor for the latest remediation guidance.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

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/21/2026, 8:16:40 PM

Last updated: 4/22/2026, 6:07:14 AM

Views: 9

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

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

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses