Skip to content
Advisory Intermediate

GHSL-2020-335: Unauthorized repository modification or secrets exfiltration in a GitHub workflow of libpasta

A GitHub workflow triggered by pull_request_target checked out and ran code from a fork's head branch, so untrusted code ran with a token that had write access to the base repository and with repository secrets available. An attacker could use a pull request from a fork to modify the base repository or exfiltrate secrets.

jarlob Follow

Originally disclosed on GitHub Security Lab

The ci.yml GitHub workflow is vulnerable to unauthorized modification of the base repository or secrets exfiltration from a Pull Request.

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 used pull_request_target, which runs with a write token and secrets, but then explicitly checked out and executed the fork's head commit.

Impact

An attacker could modify the base repository or exfiltrate secrets; the workflow set persist-credentials to false, which stops git commands from reusing the token but does not remove the token or secrets from the job.

What the attacker needed

Ability to open a pull request from a fork

The fix

The issue was fixed, presumably by not running untrusted fork code in a pull_request_target workflow.

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 can run automated jobs when someone opens a pull request. A special trigger called pull_request_target gives that job powerful permissions and secrets, because it is meant to act on the repository itself, not on the contributor's code. Here the job also downloaded and ran the contributor's code, so a stranger's code got those powers.

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

Same bug class and techniques, clearest first.