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

High 8.8 Published Updated

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

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

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

Which versions are affected by CVE-2022-39321?

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

PackageAffectedFixed in
actions/runner GitHub ActionsAll versions2.283.4
actions/runner GitHub ActionsFrom 2.284.02.285.2
actions/runner GitHub ActionsFrom 2.286.02.289.4
actions/runner GitHub ActionsFrom 2.290.02.293.1
actions/runner GitHub ActionsFrom 2.294.02.296.2

Products include 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.

Upgrade, and pass arguments to programs as a list instead of through a shell. More about Command injection.

Is CVE-2022-39321 being exploited?

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

Sources

Also known as GHSA-2c6m-6gqh-6qg3.

Is CVE-2022-39321 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free