GHSA-fwj4-72fm-c93g: Github.com/mutagen io/mutagen Under-validated ComSpec And Cmd.exe Resolution Vulnerability

LOW
Published
Advisory Summary

GHSA-fwj4-72fm-c93g is a LOW under-validated comspec and cmd.exe resolution vulnerability (General Security Weakness) affecting Github.com/mutagen io/mutagen libraries in the Go ecosystem. The issue involves under-validated comspec and cmd.exe resolution in mutagen projects. Remediation is available by upgrading affected packages to version 0.16.6, 0.17.1.

GHSA-fwj4-72fm-c93g at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-fwj4-72fm-c93g
Severity LOW
CVSS v3.1 Base Score N/A
CWE Classification General Security Weakness
Affected Product Github.com/mutagen io/mutagen
Package Ecosystem Go
Published Date
Last Updated

How to Fix GHSA-fwj4-72fm-c93g

To remediate this vulnerability, upgrade all affected Github.com/mutagen io/mutagen 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/mutagen-io/mutagen fixed: 0.16.6
Upgrade github.com/mutagen-io/mutagen to 0.16.6
github.com/mutagen-io/mutagen fixed: 0.17.1
Upgrade github.com/mutagen-io/mutagen to 0.17.1
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/mutagen-io/mutagen

How to Check if You Are Affected

To determine whether your application is affected by GHSA-fwj4-72fm-c93g, inspect your project dependencies for Github.com/mutagen io/mutagen:

inspect dependencies for github.com/mutagen-io/mutagen

Analyze the terminal output to locate any version of Github.com/mutagen io/mutagen in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.16.6), 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 General Security Weakness. In Github.com/mutagen io/mutagen, 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

### Impact Mutagen projects offer shell-based execution functionality. On Windows, the shell is resolved using the standard `%ComSpec%` mechanism, with a fallback to a `%PATH%`-based search for `cmd.exe`. While this is the standard practice on Windows systems, it presents somewhat risky behavior. Firstly, `%ComSpec%` could, in theory, be set maliciously. Unfortunately, there's not much that can be done to prevent this attack surface, because `%ComSpec%` is the official mechanism for shell specification on Windows. We can, however, validate that it points to an absolute path, which one would expect for a properly set value. Secondly, a fallback to a relative `cmd.exe` path, resolved via `%PATH%`, could be risky. The risk is largely mitigated by changes in Go 1.19 and later, but prior to that a malicious `cmd.exe` could been resolved in the current working directory. To mitigate this issue, Mutagen now uses the `%SystemRoot%` environment variable (also validated to be an absolute path) to resolve `cmd.exe` in the event that `%ComSpec%` is not set correctly. ### Patches The problem has been patched in Mutagen v0.16.6 and v0.17.1. Earlier versions of Mutagen are no longer supported and will not be patched. Versions of Mutagen after v0.18.0 will also have the patch merged. ### Workarounds Maintain control of the environment variable settings on your system, in particular the `ComSpec` environment variable. ### References More information on `%ComSpec%` can be found [online](https://en.wikipedia.org/wiki/COMSPEC). More information on Go's `PATH`-based lookup changes can be found [here](https://go.dev/blog/path-security), [here](https://go.dev/doc/go1.19#os-exec-path), and [here](https://github.com/golang/go/issues/43947). A [similar issue](https://github.com/python/cpython/issues/101283) that was addressed within the Python subprocess module also provides additional discussion.

GHSA-fwj4-72fm-c93g Affected Github.com/mutagen io/mutagen Versions

2 component(s)
Fixed Versions:
0.16.60.17.1
Product / Package Ecosystem Affected Versions Fixed Version
github.com/mutagen-io/mutagen
Go
< 0.16.6
0.16.6
github.com/mutagen-io/mutagen
Go
≥ 0.17.0
< 0.17.1
0.17.1

References

Frequently Asked Questions

What is GHSA-fwj4-72fm-c93g?
GHSA-fwj4-72fm-c93g is a security vulnerability in Github.com/mutagen io/mutagen involving Under-validated ComSpec and cmd.exe resolution in Mutagen projects under General Security Weakness.
Which Github.com/mutagen io/mutagen versions are affected?
Affected versions include releases prior to 0.16.6, 0.17.1 across affected packages: github.com/mutagen-io/mutagen.
What version fixes GHSA-fwj4-72fm-c93g?
Upgrading to 0.16.6, 0.17.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/mutagen-io/mutagen affected?
Yes, github.com/mutagen-io/mutagen is affected in releases prior to 0.16.6, 0.17.1. Upgrade your dependency to 0.16.6, 0.17.1 or later.
What CWE is associated with GHSA-fwj4-72fm-c93g?
GHSA-fwj4-72fm-c93g is classified under General Security Weakness.
How can I check Go dependencies for GHSA-fwj4-72fm-c93g?
Run the dependency tree command: 'inspect dependencies for github.com/mutagen-io/mutagen'. 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-fwj4-72fm-c93g",
  "modified" : "2023-05-05T02:18:26Z",
  "published" : "2023-05-05T02:18:26Z",
  "aliases" : [ ],
  "summary" : "Under-validated ComSpec and cmd.exe resolution in Mutagen projects",
  "details" : "### Impact\n\nMutagen projects offer shell-based execution functionality.  On Windows, the shell is resolved using the standard `%ComSpec%` mechanism, with a fallback to a `%PATH%`-based search for `cmd.exe`.  While this is the standard practice on Windows systems, it presents somewhat risky behavior.\n\nFirstly, `%ComSpec%` could, in theory, be set maliciously.  Unfortunately, there's not much that can be done to prevent this attack surface, because `%ComSpec%` is the official mechanism for shell specification on Windows.  We can, however, validate that it points to an absolute path, which one would expect for a properly set value.\n\nSecondly, a fallback to a relative `cmd.exe` path, resolved via `%PATH%`, could be risky.  The risk is largely mitigated by changes in Go 1.19 and later, but prior to that a malicious `cmd.exe` could been resolved in the current working directory.  To mitigate this issue, Mutagen now uses the `%SystemRoot%` environment variable (also validated to be an absolute path) to resolve `cmd.exe` in the event that `%ComSpec%` is not set correctly.\n\n\n### Patches\n\nThe problem has been patched in Mutagen v0.16.6 and v0.17.1. Earlier versions of Mutagen are no longer supported and will not be patched. Versions of Mutagen after v0.18.0 will also have the patch merged.\n\n\n### Workarounds\n\nMaintain control of the environment variable settings on your system, in particular the `ComSpec` environment variable.\n\n### References\n\nMore information on `%ComSpec%` can be found [online](https://en.wikipedia.org/wiki/COMSPEC).\n\nMore information on Go's `PATH`-based lookup changes can be found [here](https://go.dev/blog/path-security), [here](https://go.dev/doc/go1.19#os-exec-path), and [here](https://github.com/golang/go/issues/43947).\n\nA [similar issue](https://github.com/python/cpython/issues/101283) that was addressed within the Python subprocess module also provides additional discussion.\n",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/mutagen-io/mutagen"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.16.6"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/mutagen-io/mutagen"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.17.0"
      }, {
        "fixed" : "0.17.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/mutagen-io/mutagen/security/advisories/GHSA-fwj4-72fm-c93g"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/mutagen-io/mutagen"
  } ],
  "database_specific" : {
    "cwe_ids" : [ ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-05-05T02:18:26Z",
    "nvd_published_at" : null
  }
}