Skip to content
RCE Advisory Intermediate

GHSL-2020-189: Command injection in chocolatey-community/chocolatey-package-requests workflow

The GitHub workflow 'handle-comments.yml' used the text of a public issue comment to format a PowerShell script, allowing an attacker to inject arbitrary commands. By commenting with a crafted string, an attacker could exfiltrate the GitHub token and potentially compromise the repository.

jarlob Follow

Originally disclosed on GitHub Security Lab

The ‘handle-comments.yml’ GitHub workflow is vulnerable to arbitrary 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

Root cause

The workflow directly interpolated user-controlled comment text into a PowerShell script without sanitisation, enabling command injection.

Impact

An attacker could exfiltrate the secret GitHub access token, potentially leading to repository compromise.

What the attacker needed

Public GitHub issue; ability to comment

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 comment. Here, the workflow took the comment text and inserted it directly into a PowerShell command without checking it. That let an attacker write extra commands in their comment, which the workflow then ran with access to a secret token.

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.