Skip to content
RCE Advisory Intermediate

GHSL-2021-044: Command injection in a GitHub workflow of Homebrew/brew

A GitHub workflow used a pull request branch name to format an inline shell script, allowing an attacker to inject arbitrary commands. If the repository owner manually dispatched the workflow and did not check the branch name, the attacker could modify the base repository and exfiltrate secrets.

jarlob Follow

Originally disclosed on GitHub Security Lab

The vendor-gems.yml GitHub workflow is vulnerable to command injection.

jarlob, on GitHub Security Lab

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

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 the base repository and exfiltrate secrets if the repository owner manually dispatched the workflow and did not pay attention to the branch name.

What the attacker needed

Attacker creates a pull request; repository owner manually dispatches workflow; owner does not check branch name

The fix

The issue was fixed.

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.

A GitHub workflow is an automated script that runs when something happens, like a pull request. Here, the script took the name of the branch from the pull request and put it directly into a shell command without cleaning it. An attacker could name their branch in a way that includes extra shell commands, which would then run with the workflow's permissions.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More by jarlob

View all

192 more disclosed reports, best first.

More from GitHub Security Lab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.