Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CVE-2026-40876— SFTP root escape via prefix-based path validation in goshs

EPSS 0.05% · P16
Get alerts for future matching vulnerabilitiesLog in to subscribe

I. Basic Information for CVE-2026-40876

Vulnerability Information

Have questions about the vulnerability? See if Shenlong's analysis helps!
View Shenlong Deep Dive ↗

Although we use advanced large model technology, its output may still contain inaccurate or outdated information.Shenlong tries to ensure data accuracy, but please verify and judge based on the actual situation.

Vulnerability Title
SFTP root escape via prefix-based path validation in goshs
Source: NVD (National Vulnerability Database)
Vulnerability 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.
Source: NVD (National Vulnerability Database)
CVSS Information
N/A
Source: NVD (National Vulnerability Database)
Vulnerability Type
对路径名的限制不恰当(路径遍历)
Source: NVD (National Vulnerability Database)
Vulnerability Title
goshs 路径遍历漏洞
Source: CNNVD (China National Vulnerability Database)
Vulnerability Description
goshs是Patrick Hener个人开发者的一个用Go编写的简单HTTP Server。 goshs 2.0.0-beta.6之前版本存在路径遍历漏洞,该漏洞源于SFTP子系统sanitizePath函数使用基于前缀的路径验证,可能导致经过身份验证的SFTP用户读写配置根目录之外的文件系统路径。
Source: CNNVD (China National Vulnerability Database)
CVSS Information
N/A
Source: CNNVD (China National Vulnerability Database)
Vulnerability Type
N/A
Source: CNNVD (China National Vulnerability Database)

Affected Products

VendorProductAffected VersionsCPESubscribe
patrickhenergoshs < 2.0.0-beta.6 -

II. Public POCs for CVE-2026-40876

#POC DescriptionSource LinkShenlong Link
AI-Generated POCPremium

No public POC found.

Login to generate AI POC

III. Intelligence Information for CVE-2026-40876

登录查看更多情报信息。

Same Patch Batch · patrickhener · 2026-04-21 · 5 CVEs total

CVE-2026-408849.8 CRITICALgoshs: Empty-username SFTP password authentication bypass in goshs
CVE-2026-409039.1 CRITICALGoshs - ArtiPACKED Vulnerability – GitHub Actions Credential Persistence
CVE-2026-40883goshs: CSRF in state-changing GET routes enables authenticated file deletion and directory
CVE-2026-40885goshs: Public collaborator feed leaks .goshs ACL credentials and enables unauthorized acce

IV. Related Vulnerabilities

V. Comments for CVE-2026-40876

No comments yet


Leave a comment