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.
The ant-design/ui.yml, ant-design-pro/preview.yml and pro-components/preview.yml GitHub workflows are vulnerable to arbitrary code execution.
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
- Fork the repository.
- Create a pull request with malicious code in the build scripts.
- The pull_request_target workflow checks out the pull request code.
- The workflow runs npm install and build, executing the malicious code.
- 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.