Skip to content
RCE Advisory Intermediate

GHSL-2023-181: Expression injection in the GitHub Action workflow of Pytorch

The filter-test-configs workflow used the raw branch name from a workflow_run event in a shell command, allowing an attacker to inject commands via a malicious branch name. This could lead to command execution and potential theft of workflow secrets.

jorgectf Follow

Originally disclosed on GitHub Security Lab

The pytorch/pytorch filter-test-configs workflow is vulnerable to an expression injection in Actions, allowing an attacker to potentially leak secrets and alter the repository using the workflow.

jorgectf, 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 the untrusted github.event.workflow_run.head_branch value into a shell command without sanitisation.

Impact

This issue may lead to stealing workflow secrets.

What the attacker needed

Repository uses filter-test-configs in pull_request_target…; attacker can create a branch with a malicious name

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.

This is about a GitHub Actions workflow that takes a branch name from an event and puts it directly into a shell command. If an attacker creates a branch with a special name, they can trick the command into running their own code, which might let them steal secret keys used by the workflow.

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 jorgectf

View all

34 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.