CVE-2022-22984: Snyk plugins command injection

CVE-2022-22984 · Severity: low · CVSS 3.1 · Published 2022-11-30

Snyk's vulnerability scanning tools and plugins contained a command injection flaw that could allow attackers to execute arbitrary commands on systems running the Snyk CLI. An attacker could exploit this by crafting malicious command-line arguments passed to the Snyk test command, potentially compromising build pipelines and CI/CD systems where developers use these tools to scan project dependencies for security issues.

Technologies: snyk (npm). Vendors: npm, Snyk.

Quick answers

Is CVE-2022-22984 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2022-22984 being exploited in the wild.
How severe is CVE-2022-22984?
Low severity, with a CVSS score of 3.1, published 30 November 2022.
Which products and versions are affected?
@snyk/snyk-cocoapods-plugin (npm) SEMVER:introduced=0,fixed=2.5.3; @snyk/snyk-hex-plugin (npm) SEMVER:introduced=0,fixed=1.1.6; snyk (npm) SEMVER:introduced=0,fixed=1.1064.0; snyk-docker-plugin (npm) SEMVER:introduced=0,fixed=5.6.5; and 6 more.
Is there a fix for CVE-2022-22984?
Yes. @snyk/snyk-cocoapods-plugin (npm): upgrade to 2.5.3 or later; @snyk/snyk-hex-plugin (npm): upgrade to 1.1.6 or later; snyk (npm): upgrade to 1.1064.0 or later; snyk-docker-plugin (npm): upgrade to 5.6.5 or later; snyk-gradle-plugin (npm): upgrade to 3.24.5 or later; snyk-mvn-plugin (npm): upgrade to 2.31.3 or later; snyk-python-plugin (npm): upgrade to 1.24.2 or later; snyk-sbt-plugin (npm): upgrade to 2.16.2 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2022-22984 attacked?
It is attacked over the network, in a software library.
Am I affected by CVE-2022-22984?
Check whether you run @snyk/snyk-cocoapods-plugin (npm), @snyk/snyk-hex-plugin (npm), snyk (npm) or one of the others listed at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • @snyk/snyk-cocoapods-plugin (npm): upgrade to 2.5.3 or later
    npm install @snyk/snyk-cocoapods-plugin@2.5.3
  • @snyk/snyk-hex-plugin (npm): upgrade to 1.1.6 or later
    npm install @snyk/snyk-hex-plugin@1.1.6
  • snyk (npm): upgrade to 1.1064.0 or later
    npm install snyk@1.1064.0
  • snyk-docker-plugin (npm): upgrade to 5.6.5 or later
    npm install snyk-docker-plugin@5.6.5
  • snyk-gradle-plugin (npm): upgrade to 3.24.5 or later
    npm install snyk-gradle-plugin@3.24.5
  • snyk-mvn-plugin (npm): upgrade to 2.31.3 or later
    npm install snyk-mvn-plugin@2.31.3
  • snyk-python-plugin (npm): upgrade to 1.24.2 or later
    npm install snyk-python-plugin@1.24.2
  • snyk-sbt-plugin (npm): upgrade to 2.16.2 or later
    npm install snyk-sbt-plugin@2.16.2

Technical details

This is a command injection vulnerability (CWE-78) in Snyk's CLI and plugin suite resulting from an incomplete fix for CVE-2022-40764. The vulnerability stems from improper escaping of child process arguments when spawning subprocesses. An attacker can inject arbitrary shell commands by manipulating command-line flags passed to the snyk test command. Exploitation requires that a user executes the Snyk CLI on attacker-controlled or untrusted files, but in CI/CD pipeline contexts where developers control arguments, this can be leveraged for pipeline compromise. The issue has been patched across all affected plugins by properly escaping/quoting spawn arguments before passing them to child processes.

Affected products

  • Snyk snyk before 1.1064.0
  • Snyk snyk-mvn-plugin before 2.31.3
  • Snyk snyk-gradle-plugin before 3.24.5
  • Snyk snyk-cocoapods-plugin before 2.5.3
  • Snyk snyk-sbt-plugin before 2.16.2
  • Snyk snyk-python-plugin before 1.24.2
  • Snyk snyk-docker-plugin before 5.6.5
  • Snyk snyk-hex-plugin before 1.1.6

Identifiers

  • CVE-2022-22984
  • GHSA-4x6g-3cmx-w76r

Timeline

  • 2022-11-30: disclosed: Advisory published
  • 2022-11-29: patched: Fixes available in Snyk Docker images as of 2022-11-29
  • 2022-11-30: other: Snyk TeamCity CI/CD plugin patched as of version v20221130.093605

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.