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

Goal: 1000 CNY · Raised: 1359 CNY

100%

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

Quick assessment

Affected
patrickhener goshs
Exploitation
No confirmed in-the-wild exploitation; assess based on exposure
Recommended action
Check the vendor advisory and references for a fixed version. If immediate upgrade is impossible, restrict exposure and increase monitoring.

goshs是Patrick Hener个人开发者的一个用Go编写的简单HTTP Server。 goshs 2.0.0-beta.6之前版本存在路径遍历漏洞,该漏洞源于SFTP子系统sanitizePath函数使用基于前缀的路径验证,可能导致经过身份验证的SFTP用户读写配置根目录之外的文件系统路径。

AI Predicted 7.5 Difficulty: Easy EPSS 0.59% · P46
Get alerts for future matching vulnerabilities Log 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: CVE Program / CVE List V5
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: CVE Program / CVE List V5
CVSS Information
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
Source: CVE Program / CVE List V5
Vulnerability Type
对路径名的限制不恰当(路径遍历)
Source: CVE Program / CVE List V5
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

Vendor Product Affected Versions CPE Subscribe
patrickhener goshs < 2.0.0-beta.6 -

II. Public POCs for CVE-2026-40876

# POC Description Source Link Shenlong Link
AI-Generated POC Premium

No public POC found.

Login to generate AI POC

III. Intelligence Information for CVE-2026-40876

请登录查看更多情报信息。

Vendor Advisories for CVE-2026-40876 (1)

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

CVE-2026-40884 9.8 CRITICAL goshs: Empty-username SFTP password authentication bypass in goshs
CVE-2026-40903 9.1 CRITICAL Goshs - ArtiPACKED Vulnerability – GitHub Actions Credential Persistence
CVE-2026-40883 goshs: CSRF in state-changing GET routes enables authenticated file deletion and directory
CVE-2026-40885 goshs: 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