Skip to content
Advisory Intermediate

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.

Alvaro Muñoz Follow

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.

pwntester, on GitHub Security Lab

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

  1. An attacker triggers a workflow by sending a pull request or commenting on a pull request.
  2. The workflow runs a changes job that determines the merge commit SHA of the pull request.
  3. A second job checks out the merge commit, including attacker-controlled files.
  4. 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.

More by Alvaro Muñoz

View all

132 more disclosed reports, best first.

More from GitHub Security Lab

View all

The newest disclosed reports for this program.

Similar reports

Same bug class and techniques, clearest first.