CVE-2026-40876

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.
Configurations

Configuration 1 (hide)

OR cpe:2.3:a:goshs:goshs:*:*:*:*:*:go:*:*
cpe:2.3:a:goshs:goshs:2.0.0:beta1:*:*:*:go:*:*
cpe:2.3:a:goshs:goshs:2.0.0:beta2:*:*:*:go:*:*
cpe:2.3:a:goshs:goshs:2.0.0:beta3:*:*:*:go:*:*
cpe:2.3:a:goshs:goshs:2.0.0:beta4:*:*:*:go:*:*
cpe:2.3:a:goshs:goshs:2.0.0:beta5:*:*:*:go:*:*

History

24 Apr 2026, 20:38

Type Values Removed Values Added
References () https://github.com/patrickhener/goshs/security/advisories/GHSA-5h6h-7rc9-3824 - () https://github.com/patrickhener/goshs/security/advisories/GHSA-5h6h-7rc9-3824 - Exploit, Vendor Advisory
CPE cpe:2.3:a:goshs:goshs:2.0.0:beta5:*:*:*:go:*:*
cpe:2.3:a:goshs:goshs:2.0.0:beta4:*:*:*:go:*:*
cpe:2.3:a:goshs:goshs:2.0.0:beta1:*:*:*:go:*:*
cpe:2.3:a:goshs:goshs:*:*:*:*:*:go:*:*
cpe:2.3:a:goshs:goshs:2.0.0:beta3:*:*:*:go:*:*
cpe:2.3:a:goshs:goshs:2.0.0:beta2:*:*:*:go:*:*
First Time Goshs goshs
Goshs
CVSS v2 : unknown
v3 : unknown
v2 : unknown
v3 : 8.8

22 Apr 2026, 14:17

Type Values Removed Values Added
References () https://github.com/patrickhener/goshs/security/advisories/GHSA-5h6h-7rc9-3824 - () https://github.com/patrickhener/goshs/security/advisories/GHSA-5h6h-7rc9-3824 -

21 Apr 2026, 20:17

Type Values Removed Values Added
New CVE

Information

Published : 2026-04-21 20:17

Updated : 2026-04-24 20:38


NVD link : CVE-2026-40876

Mitre link : CVE-2026-40876

CVE.ORG link : CVE-2026-40876


JSON object : View

Products Affected

goshs

  • goshs
CWE
CWE-22

Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')