Command injection in GitHub Actions ContainerStepHost
The GitHub Actions runner built docker commands by encoding environment variables in a way that let an input escape the variable and alter the docker invocation. An attacker who could influence an environment variable in a job using container actions, job containers, or service containers could modify the docker command directly.
- Fixed in 11 days
- Paid in 11 days
- Disclosed after 4 months
Summary by the program
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.
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
Root cause
Likely the runner did not correctly quote or escape environment variable values when building the docker command line, so a value could break out of its intended position.
Impact
Jobs that use container actions, job containers, or service containers alongside untrusted user inputs in environment variables may be vulnerable, allowing an attacker to modify the docker command invocation.
What the attacker needed
Job uses container actions, job containers, or service…; untrusted user input in an environment variable
The fix
The Actions Runner was patched in versions 2.296.2, 2.293.1, 2.289.4, 2.285.2, and 2.283.4, and a workaround is to remove container actions, job containers, or service containers until upgrading.
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.
GitHub Actions runs jobs on a runner, which starts containers by calling the docker command. The runner put environment variable values into that command without properly separating them, so a crafted value could break out and add extra docker options. This could let someone change how the container runs.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.