High severity7.7NVD Advisory· Published Apr 10, 2026· Updated Apr 14, 2026
CVE-2026-40188
CVE-2026-40188
Description
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.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
github.com/patrickhener/goshsGo | >= 1.0.7, <= 1.1.4 | — |
Affected products
4Patches
1141c188ce270Fix a bug where the wrong port was used in sftpserver and fix the security issue reported at https://github.com/patrickhener/goshs/security/advisories/GHSA-2943-crp8-38xx
2 files changed · +8 −2
sftpserver/helper.go+7 −1 modified@@ -212,7 +212,13 @@ func cmdFile(root string, r *sftp.Request, ip string, sftpServer *SFTPServer) er } case "Rename": - err := os.Rename(fullPath, r.Target) + targetPath, err := sanitizePath(r.Target, root) + if err != nil { + logger.LogSFTPRequestBlocked(r, ip, err) + sftpServer.HandleWebhookSend("sftp", r, ip, true) + return err + } + err = os.Rename(fullPath, targetPath) if err != nil { logger.LogSFTPRequestBlocked(r, ip, err) sftpServer.HandleWebhookSend("sftp", r, ip, true)
sftpserver/sftpserver.go+1 −1 modified@@ -32,7 +32,7 @@ type SFTPServer struct { func NewSFTPServer(opts *options.Options, wl *httpserver.Whitelist, webhook webhook.Webhook) *SFTPServer { return &SFTPServer{ IP: opts.IP, - Port: opts.Port, + Port: opts.SFTPPort, KeyFile: opts.SFTPKeyFile, Username: opts.Username, Password: opts.Password,
Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
5- github.com/patrickhener/goshs/commit/141c188ce270ffbec087844a50e5e695b7da7744nvdPatchWEB
- github.com/patrickhener/goshs/security/advisories/GHSA-2943-crp8-38xxnvdExploitVendor AdvisoryWEB
- github.com/advisories/GHSA-2943-crp8-38xxghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2026-40188ghsaADVISORY
- github.com/patrickhener/goshs/releases/tag/v2.0.0-beta.4nvdProductRelease NotesWEB
News mentions
0No linked articles in our index yet.