Delimiter injection in GitHub Actions core.exportVariable
The `core.exportVariable` function in GitHub Actions Toolkit used a fixed delimiter that attackers could inject to break out of the intended variable and set arbitrary environment variables. This could allow modification of the PATH or other environment variables, and a separate report demonstrated remote code execution.
- Triaged in 17 days
- Fixed in 27 days
- Paid in 27 days
- Disclosed after 44 days
Summary by the program
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.
CVE-2022-35954
Summary by the researcher
Poor delimiter handling in @actions/core led to a remote attacker being able to define arbitrary environment variables. In a separate report, #1637621, remote code execution in the GitHub Actions runner enabled by this bug was demonstrated.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Impact
An attacker could modify environment variables such as PATH, and a separate report demonstrated that this could lead to remote code execution in the GitHub Actions runner.
What the attacker needed
Workflow writes untrusted input to GITHUB_ENV; attacker can control that input
The fix
The issue was fixed in `@actions/core` version 1.9.1; if upgrading is not possible, validate that user input does not contain the delimiter before calling `core.exportVariable`.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When a GitHub Action writes a value to a special file, it uses a marker to separate the variable name from its value. If an attacker can include that marker in their input, they can trick the system into thinking the value has ended and start a new variable assignment. This lets them set environment variables they shouldn't control, which can change how the action runs.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.