Skip to content
RCE Advisory Intermediate

GHSL-2020-246: Unauthorized repository modification or secrets exfiltration in GitHub workflows of ant-design

The GitHub workflows used the pull_request_target event, which gives access to secrets and a write token, but then checked out and ran code from the pull request. An attacker could open a pull request from a fork to execute arbitrary code, modify the base repository, or exfiltrate secrets.

jarlob Follow

Originally disclosed on GitHub Security Lab

The ant-design/ui.yml, ant-design-pro/preview.yml and pro-components/preview.yml GitHub workflows are vulnerable to arbitrary code execution.

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

The vulnerability allows for unauthorized modification of the base repository and secrets exfiltration.

What the attacker needed

Ability to open a pull request from a fork

The fix

The issue was fixed.

How it was found

  1. Fork the repository.
  2. Create a pull request with malicious code in the build scripts.
  3. The pull_request_target workflow checks out the pull request code.
  4. The workflow runs npm install and build, executing the malicious code.
  5. The code can access secrets and push to the base repository.

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 workflows can be triggered by pull requests. The pull_request_target trigger gives the workflow access to secrets and write permissions, but it is supposed to run in the context of the base repository, not the fork. Here, the workflow checked out and ran code from the fork, so an attacker could run their own code with those privileges.

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.