GHSL-2020-266: Unauthorized repository modification or secrets exfiltration in a GitHub workflow of afc163/surge-preview
The surge-preview GitHub action and its own repository workflow use pull_request_target and check out and run untrusted code from pull requests, giving that code write access to the base repository and secrets. An attacker could open a pull request to modify the repository or exfiltrate secrets.
The design and promoted usage examples of afc163/surge-preview GitHub action makes the consuming workflows vulnerable to arbitrary code execution. The repository of afc163/surge-preview GitHub action falls into the same trap and is 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 using repository and secrets exfiltration.
What the attacker needed
Repository uses surge-preview with pull_request_target; attacker can open a pull request
The fix
The issue was resolved, but the text does not describe the fix.
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 workflows when a pull request is opened. The pull_request_target event gives the workflow write access to the repository and access to secrets, but it is supposed to run only trusted code. Here, the workflow checks out and runs code from the pull request itself, so an attacker can run their own commands 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.