8.8

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

Analyzed
AliasesGHSA-5h6h-7rc9-3824GO-2026-5146
Published 21-04-2026Last modified 22-04-2026

Vulnerability summary

CVE-2026-40876 is a high (CVSS 8.8) Path Traversal vulnerability in goshs. EPSS estimates a 0.59% chance of exploitation in the next 30 days, higher than 47.5% of scored vulnerabilities. 1 public exploit is recorded.

Overall risk
45/100
0100
Medium · default modelHow is this calculated?
CVSS score
8.8/10
010
High · v3.1 (NVD)
EPSS score
0.59%
0%100%
Low · +0.15 pp in 30 days
KEVNot listedNot listed by any tracked catalog.
RansomwareNot flaggedNo ransomware use recorded.
Public exploits1github

Advisory lineage

Upstream 0 · Downstream 1 · Related 1

Timeline

  1. 21-04-2026
    PublishedVulnerability first disclosed.
  2. 22-04-2026
    Last modifiedVulnerability information updated.

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.

CVSS metrics

5 scores · 3 sources · 2 versions

EPSS trend

Probability

0.59%

Chance of exploitation in the next 30 days

Percentile

48%

Versus all other CVEs

30-day change

Increase +0.15 pp

From 0.44% on 22-09-2026

22-09-202622-10-2026

Known exploited

Compare KEV catalogs
CISA KEV

Not in the CISA KEV catalog.

ENISA CNW

Not in the ENISA CNW catalog.

CIRCL

Not in the CIRCL catalog.

Public exploits

1 found
  • githubUnverified

    Goshs

    Maturity: poc

Weaknesses

CWE · root cause

Affected systems

Github.com/patrickhener1 product
  • goshs≤ 1.1.4 | All versions (No fix recorded)
Github.com/patrickhener/goshs1 product
  • v2< 2.0.0
Goshs1 product
  • goshs< 2.0.0 | 2.0.0:beta1 | 2.0.0:beta2 | 2.0.0:beta3 | 2.0.0:beta4 | 2.0.0:beta5
Patrickhener1 product

4 vendors · 4 products

References

4 links