# CVE-2022-39321: GitHub Actions Runner vulnerable to Docker Command Escaping

> Attackers can inject commands into Docker invocations via environment variables in GitHub Actions workflows using container features.

- **Severity:** High 8.8 (`CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 25 Oct 2022
- **Updated:** 23 Apr 2025
- **Also known as:** GHSA-2c6m-6gqh-6qg3

## What is CVE-2022-39321?

CVE-2022-39321 is a high-severity command injection vulnerability in actions runner, published on 25 Oct 2022. Any signed-in user can exploit it over the network, with no action from the victim.

### Official description

GitHub Actions Runner is the application that runs a job from a GitHub Actions workflow. 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 in versions prior to 2.296.2, 2.293.1, 2.289.4, 2.285.2, and 2.283.4 that allows an input to escape the environment variable and modify that docker command invocation directly. Jobs that use container actions, job containers, or service containers alongside untrusted user inputs in environment variables may be vulnerable. The Actions Runner has been patched, both on `github.com` and hotfixes for GHES and GHAE customers in versions 2.296.2, 2.293.1, 2.289.4, 2.285.2, and 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. As a workaround, users may consider removing any container actions, job containers, or service containers from their jobs until they are able to upgrade their runner versions.

Weakness: CWE-78 (Improper Neutralization of Special Elements used in an OS Command)

## Which versions are affected by CVE-2022-39321?

5 open source packages ship an affected version, including actions/runner. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `actions/runner` | GitHub Actions | All versions | 2.283.4 |
| `actions/runner` | GitHub Actions | From 2.284.0 | 2.285.2 |
| `actions/runner` | GitHub Actions | From 2.286.0 | 2.289.4 |
| `actions/runner` | GitHub Actions | From 2.290.0 | 2.293.1 |
| `actions/runner` | GitHub Actions | From 2.294.0 | 2.296.2 |

Products: Github Runner.

## How do I fix CVE-2022-39321?

Upgrade actions/runner to a fixed version for your release line: 2.283.4, 2.285.2, 2.289.4 or 2.293.1.

## Is CVE-2022-39321 being exploited?

There is no known exploitation of CVE-2022-39321 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2022-39321 and fix it if it is affected.

What it is: CVE-2022-39321 is a high-severity command injection vulnerability in actions runner, published on 25 Oct 2022. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2022-39321 in the wild and no public exploit code.

Affected packages and fixed versions:
- actions/runner (GitHub Actions): affected all versions; fixed in 2.283.4
- actions/runner (GitHub Actions): affected from 2.284.0; fixed in 2.285.2
- actions/runner (GitHub Actions): affected from 2.286.0; fixed in 2.289.4
- actions/runner (GitHub Actions): affected from 2.290.0; fixed in 2.293.1
- actions/runner (GitHub Actions): affected from 2.294.0; fixed in 2.296.2

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2022-39321/ (Markdown: https://insights.sbomify.com/CVE-2022-39321/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2022-39321
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2022-39321
- OSV: https://osv.dev/vulnerability/CVE-2022-39321

---
From sbomify Insights: https://insights.sbomify.com/CVE-2022-39321/
Summaries are generated and may contain mistakes; the official description above is the record.
