GHSL-2020-275: Arbitrary code execution in LedgerHQ/ledger-live-desktop workflow
A GitHub Actions workflow used the pull_request_target trigger but then checked out and ran code from the pull request's fork. An attacker could open a pull request from a fork and have their code run with the base repository's write token and secrets, allowing repository modification and secret theft.
The ci.yml GitHub workflow is vulnerable to unauthorized modification of the base repository or secrets exfiltration from a Pull Request.
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 combined the privileged pull_request_target trigger with an explicit checkout of the pull request head from the fork and then executed its build scripts.
Impact
An attacker could modify the base repository and exfiltrate secrets.
What the attacker needed
Ability to open a pull request from a fork
The fix
The issue was resolved, presumably by no longer checking out and running fork code under the privileged trigger.
How it was found
- Open a pull request from a fork against the repository.
- The pull_request_target workflow triggers and checks out the fork's head commit.
- The workflow runs the fork's dependency install and code checks.
- The attacker's code executes with the base repository token and secrets.
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 are automated jobs that run when something happens on a repository, such as a pull request. The pull_request_target trigger gives those jobs powerful access (a write token and secrets) but is meant to run only trusted code from the main repository. Here the job also downloaded and ran code from the contributor's fork, so a stranger's code got those powerful permissions.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.