CVE-2026-40876

HIGH CVSS 4.0: 8.7 EPSS 0.46%
Updated Oct 27, 2026
Goshs
Parameter Value
CVSS 8.7 (HIGH)
Affected Versions before 2.0.0
Fixed In 2.0.0
Type CWE-22 (Path Traversal)
Vendor Goshs
Public PoC No

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.

Attack Parameters

Attack Vector
Network
Can be exploited remotely
Attack Complexity
Low
Easy to exploit
Attack Requirements
None
No additional conditions
Privileges Required
Low
Basic privileges needed
User Interaction
None
No user interaction needed

Impact Assessment

Confidentiality
High
Complete data leak
Integrity
High
Complete data modification
Availability
High
Complete denial of service

CVSS Vector v4.0

Weakness Type (CWE)

Vulnerable Products 6

Configuration From (including) Up to (excluding)
Goshs Goshs
cpe:2.3:a:goshs:goshs:*:*:*:*:*:go:*:*
— 2.0.0
Goshs Goshs
cpe:2.3:a:goshs:goshs:2.0.0:beta1:*:*:*:go:*:*
— —
Goshs Goshs
cpe:2.3:a:goshs:goshs:2.0.0:beta2:*:*:*:go:*:*
— —
Goshs Goshs
cpe:2.3:a:goshs:goshs:2.0.0:beta3:*:*:*:go:*:*
— —
Goshs Goshs
cpe:2.3:a:goshs:goshs:2.0.0:beta4:*:*:*:go:*:*
— —
Goshs Goshs
cpe:2.3:a:goshs:goshs:2.0.0:beta5:*:*:*:go:*:*
— —