Skip to main content

CVE-2022-35954: CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection') in actions toolkit

Medium
Published: Sat Aug 13 2022 (08/13/2022, 23:40:09 UTC)
Source: CVE
Vendor/Project: actions
Product: toolkit

Description

The GitHub Actions ToolKit provides a set of packages to make creating actions easier. The `core.exportVariable` function uses a well known delimiter that attackers can use to break out of that specific variable and assign values to other arbitrary variables. Workflows that write untrusted values to the `GITHUB_ENV` file may cause the path or other environment variables to be modified without the intention of the workflow or action author. Users should upgrade to `@actions/core v1.9.1`. If you are unable to upgrade the `@actions/core` package, you can modify your action to ensure that any user input does not contain the delimiter `_GitHubActionsFileCommandDelimeter_` before calling `core.exportVariable`.

AI-Powered Analysis

AILast updated: 06/22/2025, 23:50:58 UTC

Technical Analysis

CVE-2022-35954 is a command injection vulnerability classified under CWE-77, affecting the GitHub Actions Toolkit, specifically versions up to and including 1.9.0 of the @actions/core package. The vulnerability arises from improper neutralization of special elements used in commands within the core.exportVariable function. This function uses a well-known delimiter string to separate environment variable assignments in the GITHUB_ENV file. An attacker who can supply untrusted input to this function may exploit the delimiter to break out of the intended variable assignment context and inject arbitrary environment variable assignments. This can lead to modification of critical environment variables such as PATH or others, potentially altering the behavior of subsequent workflow steps or actions in a malicious manner. The vulnerability is particularly relevant in workflows that write untrusted or user-controlled values to the GITHUB_ENV file without proper sanitization. The recommended remediation is to upgrade to @actions/core version 1.9.1 or later, where this issue is fixed. If upgrading is not feasible, developers should implement input validation to ensure that user inputs do not contain the delimiter string "_GitHubActionsFileCommandDelimeter_" before invoking core.exportVariable. No known exploits have been reported in the wild as of the publication date. The vulnerability affects the integrity and potentially the availability of GitHub Actions workflows by allowing unauthorized environment variable manipulation, which can lead to arbitrary command execution within the CI/CD pipeline context.

Potential Impact

For European organizations relying on GitHub Actions for continuous integration and deployment, this vulnerability poses a risk to the integrity and reliability of their software delivery pipelines. An attacker able to inject malicious environment variables could manipulate build or deployment steps, potentially leading to unauthorized code execution, data leakage, or disruption of service. This is especially critical for organizations handling sensitive data or operating in regulated sectors such as finance, healthcare, or critical infrastructure, where CI/CD pipeline integrity is paramount. The ability to modify environment variables like PATH can allow attackers to redirect execution flow to malicious binaries or scripts, compromising the build environment and potentially introducing backdoors or malware into production software. Although exploitation requires the ability to influence workflow inputs, many organizations use third-party actions or accept inputs from external contributors, increasing the attack surface. The vulnerability could also undermine trust in automated workflows, leading to operational delays and increased security scrutiny. Given the widespread adoption of GitHub Actions across Europe, the impact could be significant if not mitigated promptly.

Mitigation Recommendations

1. Immediate upgrade to @actions/core version 1.9.1 or later to incorporate the official fix addressing the delimiter injection issue. 2. Audit all GitHub Actions workflows to identify any usage of core.exportVariable and verify that inputs to this function are either hardcoded or properly sanitized. 3. Implement strict input validation or sanitization routines to reject or escape any input containing the delimiter string "_GitHubActionsFileCommandDelimeter_" before passing it to core.exportVariable. 4. Restrict or review third-party GitHub Actions used in workflows to ensure they do not expose untrusted inputs to vulnerable functions. 5. Employ least privilege principles in GitHub Actions workflows, limiting permissions and secrets exposure to reduce potential damage from compromised workflows. 6. Monitor workflow runs for unusual environment variable changes or unexpected behavior that could indicate exploitation attempts. 7. Educate developers and DevOps teams about this vulnerability and secure coding practices when handling environment variables in CI/CD pipelines. 8. Consider implementing additional runtime security controls such as container isolation or ephemeral build environments to limit the impact of any injected malicious commands.

Need more detailed analysis?Get Pro

Technical Details

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

Threat ID: 682d9844c4522896dcbf3b51

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

Last enriched: 6/22/2025, 11:50:58 PM

Last updated: 7/28/2025, 10:49:48 AM

Views: 13

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