CVE-2022-39321: Actions/runner Docker Command Escaping Vulnerability

HIGH
Advisory Identifier: GHSA-2c6m-6gqh-6qg3
CVSS 8.8
CWE-78
Published
Advisory Summary

CVE-2022-39321 is a HIGH (CVSS 8.8) docker command escaping vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting Actions/runner libraries in the GitHub Actions ecosystem. The issue involves docker command escaping in the github actions runner. Remediation is available by upgrading affected packages to version 2.296.2, 2.293.1, 2.289.4, 2.285.2, 2.283.4.

CVE-2022-39321 at a Glance

CVE Identifier CVE-2022-39321
GHSA Identifier GHSA-2c6m-6gqh-6qg3
Severity HIGH
CVSS v3.1 Base Score 8.8
CWE Classification CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Affected Product Actions/runner
Package Ecosystem GitHub Actions
Published Date
Last Updated

Security Impact

CVSS: 8.8

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:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
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-39321

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

actions/runner fixed: 2.296.2
Upgrade actions/runner to 2.296.2
actions/runner fixed: 2.293.1
Upgrade actions/runner to 2.293.1
actions/runner fixed: 2.289.4
Upgrade actions/runner to 2.289.4
actions/runner fixed: 2.285.2
Upgrade actions/runner to 2.285.2
actions/runner fixed: 2.283.4
Upgrade actions/runner to 2.283.4
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 actions/runner

How to Check if You Are Affected

To determine whether your application is affected by CVE-2022-39321, inspect your project dependencies for Actions/runner:

inspect dependencies for actions/runner

Analyze the terminal output to locate any version of Actions/runner in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.296.2), 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 Actions/runner, 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 The actions runner invokes the docker cli directly in order to run job containers, service containers, or container actions. A bug in the logic for how the environment is encoded into these docker commands was discovered that allows an input to escape the environment variable and modify that docker command invocation directly. Jobs that use [container actions](https://docs.github.com/en/actions/creating-actions/creating-a-docker-container-action), [job containers](https://docs.github.com/en/actions/using-jobs/running-jobs-in-a-container), or [service containers](https://docs.github.com/en/actions/using-containerized-services/about-service-containers) alongside untrusted user inputs in environment variables may be vulnerable. ### Patches The Actions Runner has been patched, both on `github.com` and hotfixes for GHES and GHAE customers. Please update to one of the following versions of the runner: - 2.296.2 - 2.293.1 - 2.289.4 - 2.285.2 - 2.283.4 GHES and GHAE customers may want to patch their instance in order to have their runners automatically upgrade to these new runner versions. ### Workarounds You may want to consider removing any container actions, job containers, or service containers from your jobs until you are able to upgrade your runner versions. ### For more information If you have any questions or comments about this advisory: * Open an issue in [the actions runner](https://github.com/actions/runner)

CVE-2022-39321 Affected Actions/runner Versions

5 component(s)
Fixed Versions:
2.296.22.293.12.289.42.285.22.283.4
Product / Package Ecosystem Affected Versions Fixed Version
actions/runner
GitHub Actions
≥ 2.294.0
< 2.296.2
2.296.2
actions/runner
GitHub Actions
≥ 2.290.0
< 2.293.1
2.293.1
actions/runner
GitHub Actions
≥ 2.286.0
< 2.289.4
2.289.4
actions/runner
GitHub Actions
≥ 2.284.0
< 2.285.2
2.285.2
actions/runner
GitHub Actions
< 2.283.4
2.283.4

References

Frequently Asked Questions

What is CVE-2022-39321?
CVE-2022-39321 is a security vulnerability in Actions/runner involving Docker Command Escaping in the GitHub Actions Runner under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Which Actions/runner versions are affected?
Affected versions include releases prior to 2.296.2, 2.293.1, 2.289.4, 2.285.2, 2.283.4 across affected packages: actions/runner.
What version fixes CVE-2022-39321?
Upgrading to 2.296.2, 2.293.1, 2.289.4, 2.285.2, 2.283.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is actions/runner affected?
Yes, actions/runner is affected in releases prior to 2.296.2, 2.293.1, 2.289.4, 2.285.2, 2.283.4. Upgrade your dependency to 2.296.2, 2.293.1, 2.289.4, 2.285.2, 2.283.4 or later.
What is the CVSS score of CVE-2022-39321?
CVE-2022-39321 has a CVSS v3.1 base score of 8.8 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2022-39321?
CVE-2022-39321 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 GitHub Actions dependencies for CVE-2022-39321?
Run the dependency tree command: 'inspect dependencies for actions/runner'. 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-2c6m-6gqh-6qg3",
  "modified" : "2022-10-25T19:54:27Z",
  "published" : "2022-10-25T19:54:27Z",
  "aliases" : [ "CVE-2022-39321" ],
  "summary" : "Docker Command Escaping in the GitHub Actions Runner",
  "details" : "### Impact\n\nThe actions runner invokes the docker cli directly in order to run job containers, service containers, or container actions. A bug in the logic for how the environment is encoded into these docker commands was discovered that allows an input to escape the environment variable and modify that docker command invocation directly. Jobs that use [container actions](https://docs.github.com/en/actions/creating-actions/creating-a-docker-container-action), [job containers](https://docs.github.com/en/actions/using-jobs/running-jobs-in-a-container), or [service containers](https://docs.github.com/en/actions/using-containerized-services/about-service-containers) alongside untrusted user inputs in environment variables may be vulnerable.\n\n### Patches\nThe Actions Runner has been patched, both on `github.com` and hotfixes for GHES and GHAE customers. Please update to one of the following versions of the runner:\n- 2.296.2\n- 2.293.1\n- 2.289.4\n- 2.285.2\n- 2.283.4\n\nGHES and GHAE customers may want to patch their instance in order to have their runners automatically upgrade to these new runner versions.\n\n### Workarounds\nYou may want to consider removing any container actions, job containers, or service containers from your jobs until you are able to upgrade your runner versions.\n\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [the actions runner](https://github.com/actions/runner)\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "GitHub Actions",
      "name" : "actions/runner"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.294.0"
      }, {
        "fixed" : "2.296.2"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "< 2.296.1"
    }
  }, {
    "package" : {
      "ecosystem" : "GitHub Actions",
      "name" : "actions/runner"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.290.0"
      }, {
        "fixed" : "2.293.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "GitHub Actions",
      "name" : "actions/runner"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.286.0"
      }, {
        "fixed" : "2.289.4"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "GitHub Actions",
      "name" : "actions/runner"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.284.0"
      }, {
        "fixed" : "2.285.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "GitHub Actions",
      "name" : "actions/runner"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.283.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/actions/runner/security/advisories/GHSA-2c6m-6gqh-6qg3"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-39321"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/actions/runner/pull/2107"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/actions/runner/pull/2108"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/actions/runner"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-78" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-10-25T19:54:27Z",
    "nvd_published_at" : "2022-10-25T17:15:00Z"
  }
}