CVE-2026-40876Goshs
High 8.7
Follow: this CVE · Goshs · Goshs We alert you by email or Slack (account required).
- Priority
- 52
- CVSS 4.0
- 8.7
- EPSS
- —
- Auth required
- Yes
- Published
- Apr 21, 2026
- Updated
- Oct 26, 2026
- Category
- Application · Cross-platform
- Weakness (CWE)
- CWE-22
- SSVC (CISA)
- Exploitation: proof of concept · Automatable: no · Technical impact: total
- 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:X
What happens
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.
What to do
- Apply the vendor's security update for Goshs.
Affected packages
| Ecosystem | Package | Affected versions | Fixed in | How to upgrade |
|---|---|---|---|---|
| Go | github.com/patrickhener/goshs |
≤ 1.1.4 |
no fixed version | — |
| Go | github.com/patrickhener/goshs |
all |
no fixed version | — |
| Go | github.com/patrickhener/goshs/v2 |
< 2.0.0 |
2.0.0 |
go get github.com/patrickhener/goshs/v2@v2.0.0 |
| Go | github.com/patrickhener/goshs/v2 |
< 2.0.0 |
2.0.0 |
go get github.com/patrickhener/goshs/v2@v2.0.0 |
Per OSV / GitHub Advisories (GHSA-5h6h-7rc9-3824, GO-2026-5146). Check the version in your lockfile before upgrading.
Affected products (CPE)
| Vendor | Product | Versions |
|---|---|---|
| goshs | goshs | < 2.0.0 |
| goshs | goshs | 2.0.0 |
| goshs | goshs | 2.0.0 |
| goshs | goshs | 2.0.0 |
| goshs | goshs | 2.0.0 |
| goshs | goshs | 2.0.0 |
Official advisories
- Security update for govulncheck-vulndb · SUSE · openSUSE-SU-2026:21483-1 · Jul 30, 2026 Critical
Vendor, CERT and distribution advisories that name this CVE. Original titles.
Official sources
References
Links published by the sources. Open them with care.
- github.com Exploit Vendor Advisory