GHSL-2020-288: Unauthorized repository modification or secrets exfiltration in GitHub workflows comsuming awslabs/one-line-scan
The awslabs/one-line-scan tool's documentation promotes using pull_request_target workflows that check out and run untrusted code from a pull request. An attacker could open a pull request that executes arbitrary commands in a workflow with write access to the base repository and access to secrets, allowing repository modification or secret exfiltration.
The design and promoted usage examples of awslabs/one-line-scan makes consuming workflows 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
Root cause
The tool's design and documentation encourage running untrusted pull request code in a pull_request_target workflow, which has write access and secrets.
Impact
An attacker could modify the repository or exfiltrate secrets, though the report notes the vulnerability was not exploited.
What the attacker needed
Repository uses the tool as documented; attacker can open a pull request
The fix
The issue was resolved by the maintainers.
How it was found
- Create a pull request against a repository that uses the tool as documented.
- Include a malicious build command in the pull request code.
- The workflow checks out the pull request code and runs the build command.
- The command executes with write access to the base repository and access to 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 workflows triggered by pull_request_target run with write permissions and secrets, but are supposed to be safe because they run in the base repository's context. This tool's example tells users to check out the pull request's code and run a build command from it, so an attacker can put malicious commands in their pull request and have them run with 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.