GHSL-2024-150_GHSL-2024-157: Possible secret exfiltration and write access to Gradio through untrusted code execution
Multiple GitHub Actions workflows in the Gradio repository checked out and executed code from untrusted pull requests, allowing an attacker to run arbitrary code and access secrets such as deployment tokens and cloud credentials.
Originally disclosed on GitHub Security Lab
Gradio contains multiple Workflows vulnerables to Execution of untrusted code enabling an attacker to steal secret tokens and gain write access to the Gradio repository.
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 workflows checked out and executed code from pull requests in a privileged context, without isolating untrusted code.
Impact
An attacker could steal secret tokens and gain write access to the Gradio repository, with the specific secrets depending on the workflow.
What the attacker needed
Ability to create a pull request or comment on one
The fix
The workflows should be fixed by not checking out and executing untrusted code in a privileged context, for example by using `pull_request_target` safely or isolating untrusted jobs.
How it was found
- An attacker triggers a workflow by sending a pull request or commenting on a pull request.
- The workflow runs a changes job that determines the merge commit SHA of the pull request.
- A second job checks out the merge commit, including attacker-controlled files.
- The workflow executes untrusted code from the checked-out files, allowing secret exfiltration.
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 tasks that run when something happens in a repository, like a pull request. If a workflow runs code from an untrusted pull request, an attacker can make that code do things like steal secret passwords stored in the repository settings. This report found several workflows in Gradio that did exactly that.