Raw vector
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:XCVSS and EPSS are reproduced from their sources (NVD, FIRST EPSS). EPSS, Forum of Incident Response and Security Teams (FIRST), epss.first.org. Risk Priority is our own derived reading, not an NVD score.
Summary
CVE-2026-40876 is a high-severity Path Traversal (CWE-22) vulnerability in Goshs. Its CVSS base score is 8.7 (High).
Operationally, exploitation aligns with the MITRE ATT&CK technique /etc/passwd and /etc/shadow (T1003.008); ranked at the 44th percentile by exploit likelihood (below the median); it is not currently listed in the CISA KEV catalog; a public proof-of-concept is referenced.
The strongest mitigations our analysis identified map to AC-3 (Access Enforcement) and SI-10 (Information Input Validation) — see the control section below for these in your framework.
Deeper analysis AI-assisted summary
Synthesised by an AI model from the NVD description and linked references — a reading aid, not an authoritative source.
goshs, a SimpleHTTPServer written in Go, is affected by CVE-2026-40876 prior to version 2.0.0-beta.6. The vulnerability is an SFTP root escape stemming from flawed prefix-based path validation in the sanitizePath() function within sftpserver/helper.go. This function performs a raw string-prefix comparison rather than a proper directory-boundary check, allowing paths like /tmp/goshsroot_evil/secret.txt to pass validation when the configured SFTP root is /tmp/goshsroot. SFTP requests are routed through sftpserver/sftpserver.go into DefaultHandler.GetHandler() in sftpserver/handler.go, which forwards operations to sinks like readFile, writeFile, listFile, and cmdFile that all rely on the vulnerable sanitizePath(). The issue is classified as CWE-22 (Path Traversal) with a CVSS v3.1 base score of 8.8 (AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H).
An authenticated SFTP user can exploit this vulnerability over the network with low complexity and no user interaction. By crafting paths that share a prefix with the configured root but reside outside it, the attacker can perform arbitrary read and write operations on the filesystem, breaking the intended jail boundary and potentially exposing or modifying unrelated server files.
The vulnerability is addressed in goshs version 2.0.0-beta.6. Security advisories recommend updating to this version or later to mitigate the issue. Further details are provided in the GitHub security advisory at https://github.com/patrickhener/goshs/security/advisories/GHSA-5h6h-7rc9-3824.
OWASP Top 10 for Web (2025)
EU & UK References
- 🇪🇺 ENISA EUVD: EUVD-2026-24260
Vulnerability Data
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…
more
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.
- CWE(s)
Related Threats
MITRE ATT&CK Enterprise Techniques
MITRE ATT&CK v20.0
CVEs Like This One
Affected Assets
Mitigating Controls
Control response
—
—
—
V5.3.2
Mitigating Controls (NIST 800-53 r5)
Our mappings, made for this CVE.
Enforces the intended directory access authorizations that path traversal would otherwise bypass.
Input validation directly neutralizes special path elements before pathname construction occurs.
Least privilege reduces the impact of any unauthorized file access obtained via traversal.
Mitigating Controls (NIST CSF 2.0)
Our mappings, derived directly from the weakness types (CWEs) cited in the NVD entry via our CWE→CSF cross-walk — links open the control.
Patching/maintenance can remediate known path-traversal flaws in deployed software (partial prevention of exploitability) but does nothing to stop the coding defect from being introduced in the first place.
Mitigating Controls (ISO/IEC 27001:2022 Annex A)
Our mappings, derived directly from the weakness types (CWEs) cited in the NVD entry via our CWE→ISO cross-walk — links open the control.
Security testing in development catches path traversal via static/dynamic analysis.
Secure coding standards explicitly forbid unsafe path construction and mandate safe APIs.
A.8.8's reach is DISCLOSURE — it sees only instances that carry a vendor-published flaw. Path traversal commonly surfaces as CVEs in third-party components (many examples in the CWE-22 record), so A.8.8 finds that disclosed share; first-party path-traversal defects in the organization's own code are invisible to vulnerability scanning and management, which is the same remainder that caps A.8.8 -> CWE-89 at `partial`.