VYPR
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.

PackageAffected versionsPatched versions
github.com/patrickhener/goshsGo
>= 1.0.7, <= 1.1.4

Affected products

4
  • Goshs/Goshs4 versions
    cpe:2.3:a:goshs:goshs:2.0.0:beta1:*:*:*:go:*:*+ 3 more
    • cpe:2.3:a:goshs:goshs:2.0.0:beta1:*:*:*:go:*:*
    • cpe:2.3:a:goshs:goshs:2.0.0:beta2:*:*:*:go:*:*
    • cpe:2.3:a:goshs:goshs:2.0.0:beta3:*:*:*:go:*:*
    • cpe:2.3:a:goshs:goshs:*:*:*:*:*:go:*:*range: >=1.0.7,<2.0.0

Patches

1
141c188ce270

Fix 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

https://github.com/patrickhener/goshsPatrick HenerApr 9, 2026via ghsa
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

News mentions

0

No linked articles in our index yet.