Skip to content
Leaked secrets Advisory Intermediate

GHSL-2024-025_GHSL-2024-026: Potential secret exfiltration from a Pull Request in AutoGen

Two GitHub Actions workflows used the pull_request_target trigger and checked out and ran code from a pull request's head commit, so a malicious pull request could run code with access to repository secrets. An attacker could exfiltrate secrets such as OpenAI and Azure API keys to a server they control.

Alvaro Muñoz Follow

Originally disclosed on GitHub Security Lab

Several GitHub workflow may leak secret API Keys (OpenAI, Azure, Bing, etc.) when triggered by any Pull Request.

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 used the pull_request_target trigger, which has access to secrets, but then checked out and executed code from the untrusted pull request head.

Impact

An attacker could exfiltrate any secrets available to the script, although the workflow had no write permissions so it could not modify the base repository.

What the attacker needed

Ability to open a pull request; attacker-controlled server to receive data

The fix

The workflows were updated to remove the pull_request_target trigger.

How it was found

  1. Clone the repository.
  2. Edit a test file to add code that sends an environment variable to an attacker-controlled server.
  3. Create a new branch and commit the change.
  4. Open a pull request.
  5. The workflow triggers and runs the modified test, sending the secret to the attacker.

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, such as a pull request. The pull_request_target trigger runs in the context of the main repository, so it can access stored secrets, but these workflows also checked out and ran code from the pull request itself. That let an outsider submit a pull request containing code that sent the repository's secret keys to a server they controlled.

What is Leaked secrets?

Keys, tokens or passwords left in public code, apps, logs or responses, that grant real access.

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

View all

Same bug class and techniques, clearest first.

Leaked secrets and credentials

The lesson behind this report.

Keys, tokens or passwords left in public code, apps, logs or responses, that grant real access.