Skip to main content

CVE-2022-39321: CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') in actions runner

Medium
Published: Tue Oct 25 2022 (10/25/2022, 00:00:00 UTC)
Source: CVE
Vendor/Project: actions
Product: runner

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.

AI-Powered Analysis

AILast updated: 06/22/2025, 15:07:28 UTC

Technical Analysis

CVE-2022-39321 is an OS command injection vulnerability affecting GitHub Actions Runner, the application responsible for executing jobs in GitHub Actions workflows. The vulnerability arises from improper neutralization of special characters in environment variables that are passed to the Docker CLI commands invoked by the runner. Specifically, the runner encodes environment variables into Docker command invocations to run job containers, service containers, or container actions. Due to a flaw in the encoding logic present in versions prior to 2.296.2, 2.293.1, 2.289.4, 2.285.2, and 2.283.4, an attacker can craft environment variable inputs that escape the intended variable context and inject arbitrary commands into the Docker CLI invocation. This can lead to execution of arbitrary OS commands on the host running the GitHub Actions Runner. The vulnerability is exploitable when workflows use container actions, job containers, or service containers and incorporate untrusted user inputs into environment variables. The issue has been patched in the specified versions, and users of GitHub Enterprise Server (GHES) and GitHub Actions Enterprise (GHAE) are advised to upgrade their runners to these fixed versions. As a temporary mitigation, users may remove container actions or containers from their workflows to avoid triggering the vulnerable code path. No known exploits have been reported in the wild to date. The vulnerability is categorized under CWE-78 (Improper Neutralization of Special Elements used in an OS Command), indicating a classic OS command injection scenario. This vulnerability allows an attacker with the ability to influence environment variables in a workflow to execute arbitrary commands on the runner host, potentially compromising the confidentiality, integrity, and availability of the system and any connected resources.

Potential Impact

For European organizations relying on GitHub Actions for CI/CD pipelines, this vulnerability poses a significant risk, especially in environments where workflows incorporate untrusted inputs into environment variables and use containerized actions or services. Successful exploitation could allow attackers to execute arbitrary commands on the runner host, leading to potential data breaches, unauthorized access to internal systems, disruption of development workflows, and possible lateral movement within the organization's network. This is particularly critical for organizations handling sensitive data or intellectual property, as compromised runners could expose source code, credentials, or deployment secrets. Additionally, since GitHub Actions runners often have elevated privileges and network access, the impact could extend beyond the runner host itself. The vulnerability could also affect organizations using self-hosted runners, which are more exposed to local exploitation. Given the widespread adoption of GitHub Actions across European tech companies, financial institutions, and government agencies, the potential impact is broad and could disrupt critical software development and deployment processes.

Mitigation Recommendations

1. Immediate upgrade of all GitHub Actions Runner instances to the patched versions (2.296.2, 2.293.1, 2.289.4, 2.285.2, or 2.283.4) as applicable. 2. For GHES and GHAE customers, ensure that the enterprise instances are patched and runners are configured to auto-upgrade to these fixed versions. 3. Temporarily remove or disable container actions, job containers, and service containers in workflows that process untrusted inputs until the runner is upgraded. 4. Audit workflows to identify any usage of environment variables derived from untrusted sources and sanitize or restrict such inputs rigorously. 5. Implement strict access controls and review permissions on repositories and workflows to limit who can modify workflows or inject environment variables. 6. Monitor runner hosts for unusual command executions or process activity indicative of exploitation attempts. 7. Consider isolating self-hosted runners in segmented network zones with limited access to sensitive resources to reduce blast radius. 8. Educate developers and DevOps teams on secure workflow design, emphasizing the risks of injecting untrusted inputs into environment variables used in containerized actions.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
GitHub_M
Date Reserved
2022-09-02T00:00:00.000Z
Cisa Enriched
true

Threat ID: 682d9846c4522896dcbf4899

Added to database: 5/21/2025, 9:09:26 AM

Last enriched: 6/22/2025, 3:07:28 PM

Last updated: 8/15/2025, 4:20:07 AM

Views: 10

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats