CVE-2022-31249: Github.com/rancher/wrangler Command Injection Vulnerability

HIGH
Advisory Identifier: GHSA-qrg7-hfx7-95c5
CVSS 7.5
CWE-78 CWE-88 CWE-77
Published
Advisory Summary

CVE-2022-31249 is a HIGH (CVSS 7.5) command injection vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting Github.com/rancher/wrangler libraries in the Go ecosystem. The issue involves command injection in git package in wrangler. Remediation is available by upgrading affected packages to version 0.7.4-security1, 0.8.5-security1, 1.0.1, 0.8.11.

CVE-2022-31249 at a Glance

CVE Identifier CVE-2022-31249
GHSA Identifier GHSA-qrg7-hfx7-95c5
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Affected Product Github.com/rancher/wrangler
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 7.5

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

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

How to Fix CVE-2022-31249

To remediate this vulnerability, upgrade all affected Github.com/rancher/wrangler 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/rancher/wrangler fixed: 0.7.4-security1
Upgrade github.com/rancher/wrangler to 0.7.4-security1
github.com/rancher/wrangler fixed: 0.8.5-security1
Upgrade github.com/rancher/wrangler to 0.8.5-security1
github.com/rancher/wrangler fixed: 1.0.1
Upgrade github.com/rancher/wrangler to 1.0.1
github.com/rancher/wrangler fixed: 0.8.11
Upgrade github.com/rancher/wrangler to 0.8.11
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/rancher/wrangler

How to Check if You Are Affected

To determine whether your application is affected by CVE-2022-31249, inspect your project dependencies for Github.com/rancher/wrangler:

inspect dependencies for github.com/rancher/wrangler

Analyze the terminal output to locate any version of Github.com/rancher/wrangler in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.7.4-security1), 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-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where the product constructs all or part of an os command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended os command when it is sent to a downstream component. In Github.com/rancher/wrangler, 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 A command injection vulnerability was discovered in Wrangler's Git package affecting versions up to and including `v1.0.0`. Wrangler's Git package uses the underlying Git binary present in the host OS or container image to execute Git operations. Specially crafted commands can be passed to Wrangler that will change their behavior and cause confusion when executed through Git, resulting in command injection in the underlying host. ### Workarounds A workaround is to sanitize input passed to the Git package to remove potential unsafe and ambiguous characters. Otherwise, the best course of action is to update to a patched Wrangler version. ### Patches Patched versions include `v1.0.1` and later and the backported tags - `v0.7.4-security1`, `v0.8.5-security1` and `v0.8.11`. ### For more information If you have any questions or comments about this advisory: * Reach out to [SUSE Rancher Security team](https://github.com/rancher/rancher/security/policy) for security related inquiries. * Open an issue in [Rancher](https://github.com/rancher/rancher/issues/new/choose) or [Wrangler](https://github.com/rancher/wrangler/issues/new) repository. * Verify our [support matrix](https://www.suse.com/suse-rancher/support-matrix/all-supported-versions/) and [product support lifecycle](https://www.suse.com/lifecycle/).

CVE-2022-31249 Affected Github.com/rancher/wrangler Versions

4 component(s)
Fixed Versions:
0.7.4-security10.8.5-security11.0.10.8.11
Product / Package Ecosystem Affected Versions Fixed Version
github.com/rancher/wrangler
Go
< 0.7.4-security1
0.7.4-security1
github.com/rancher/wrangler
Go
≥ 0.8.0
< 0.8.5-security1
0.8.5-security1
github.com/rancher/wrangler
Go
≥ 1.0.0
< 1.0.1
All 1 versions
1.0.0
1.0.1
github.com/rancher/wrangler
Go
≥ 0.8.6
< 0.8.11
0.8.11

References

Frequently Asked Questions

What is CVE-2022-31249?
CVE-2022-31249 is a security vulnerability in Github.com/rancher/wrangler involving Command injection in Git package in Wrangler under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Which Github.com/rancher/wrangler versions are affected?
Affected versions include releases prior to 0.7.4-security1, 0.8.5-security1, 1.0.1, 0.8.11 across affected packages: github.com/rancher/wrangler.
What version fixes CVE-2022-31249?
Upgrading to 0.7.4-security1, 0.8.5-security1, 1.0.1, 0.8.11 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/rancher/wrangler affected?
Yes, github.com/rancher/wrangler is affected in releases prior to 0.7.4-security1, 0.8.5-security1, 1.0.1, 0.8.11. Upgrade your dependency to 0.7.4-security1, 0.8.5-security1, 1.0.1, 0.8.11 or later.
What is the CVSS score of CVE-2022-31249?
CVE-2022-31249 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2022-31249?
CVE-2022-31249 is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') (The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.).
How can I check Go dependencies for CVE-2022-31249?
Run the dependency tree command: 'inspect dependencies for github.com/rancher/wrangler'. 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-qrg7-hfx7-95c5",
  "modified" : "2023-02-08T22:37:02Z",
  "published" : "2023-01-25T19:40:43Z",
  "aliases" : [ "CVE-2022-31249" ],
  "summary" : "Command injection in Git package in Wrangler",
  "details" : "### Impact\n\nA command injection vulnerability was discovered in Wrangler's Git package affecting versions up to and including `v1.0.0`.\n\nWrangler's Git package uses the underlying Git binary present in the host OS or container image to execute Git operations. Specially crafted commands can be passed to Wrangler that will change their behavior and cause confusion when executed through Git, resulting in command injection in the underlying host.\n\n### Workarounds\n\nA workaround is to sanitize input passed to the Git package to remove potential unsafe and ambiguous characters. Otherwise, the best course of action is to update to a patched Wrangler version.\n\n### Patches\n\nPatched versions include `v1.0.1` and later and the backported tags - `v0.7.4-security1`, `v0.8.5-security1` and `v0.8.11`.\n\n### For more information\n\nIf you have any questions or comments about this advisory:\n\n* Reach out to [SUSE Rancher Security team](https://github.com/rancher/rancher/security/policy) for security related inquiries.\n* Open an issue in [Rancher](https://github.com/rancher/rancher/issues/new/choose) or [Wrangler](https://github.com/rancher/wrangler/issues/new) repository.\n* Verify our [support matrix](https://www.suse.com/suse-rancher/support-matrix/all-supported-versions/) and [product support lifecycle](https://www.suse.com/lifecycle/).",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/rancher/wrangler"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.7.4-security1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/rancher/wrangler"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.8.0"
      }, {
        "fixed" : "0.8.5-security1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/rancher/wrangler"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.0.0"
      }, {
        "fixed" : "1.0.1"
      } ]
    } ],
    "versions" : [ "1.0.0" ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/rancher/wrangler"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.8.6"
      }, {
        "fixed" : "0.8.11"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/rancher/wrangler/security/advisories/GHSA-qrg7-hfx7-95c5"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-31249"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rancher/wrangler/commit/12397eec50155cb2d24aa70bdf9e90c5f3b9a727"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rancher/wrangler/commit/341018c8fef3e12867c7cb2649bd2cecac75f287"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rancher/wrangler/commit/5a387e13e8d51e3340d9e5012a1951f0cca5fc90"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rancher/wrangler/commit/8649ecc062204f28764fd80157a621cbae89c9cf"
  }, {
    "type" : "WEB",
    "url" : "https://bugzilla.suse.com/show_bug.cgi?id=1200299"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-qrg7-hfx7-95c5"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/rancher/wrangler"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rancher/wrangler/compare/v0.7.2...v0.7.4-security1"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rancher/wrangler/compare/v0.8.4...v0.8.5-security1"
  }, {
    "type" : "WEB",
    "url" : "https://pkg.go.dev/vuln/GO-2023-1519"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-77", "CWE-78", "CWE-88" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-01-25T19:40:43Z",
    "nvd_published_at" : "2023-02-07T13:15:00Z"
  }
}