Skip to content
Leaked secrets Advisory Intermediate

GHSL-2026-208: External pull requests can steal kptdev/kpt's SonarCloud token

A privileged SonarCloud analysis workflow checks out an external pull request's fork commit and runs SonarScanner with the repository's SONAR_TOKEN, while the fork-controlled sonar.properties can set sonar.host.url. An attacker can therefore make the scanner send the token as Bearer authentication to a server they control before analysis begins.

jarlob Follow

Originally disclosed on GitHub Security Lab

The SonarCloud analysis workflow runs in the base repository through workflowrun, checks out an external pull request’s fork commit, and invokes SonarScanner with the repository’s SONARTOKEN. A fork author can set sonar.host.url in the checked-out sonar.properties; because the workflow does not pin a trusted scanner…

jarlob, 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 privileged workflow checks out untrusted pull request code and lets it supply sonar.host.url without pinning a trusted scanner host, so the secret token is sent to an attacker-chosen destination.

Impact

An external fork author can obtain the SONAR_TOKEN and then exercise whatever permissions it carries, potentially impersonating the trusted CI scanner and corrupting authenticated analysis for the project; the exact blast radius depends on the token's type and permissions.

What the attacker needed

Ability to open an external pull request; Go workflow must run successfully; repository policy may require approval

The fix

The workflow was fixed in pull request #4780.

How it was found

  1. An external contributor changes sonar.properties in a fork and opens a pull request that triggers the Go workflow.
  2. The pull request workflow completes and uploads the coverage and PR_NUMBER artifacts.
  3. The privileged workflow_run job checks out the fork repository at the attacker-controlled head SHA.
  4. The branch-preparation commands leave the untrusted head SHA checked out, so the trusted base sonar.properties is not restored.
  5. SonarScanner reads the attacker-controlled sonar.host.url and sends SONAR_TOKEN as Bearer authentication to that server.

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.

A project's automated build system (GitHub Actions) runs a security scanning tool after pull requests. The tool reads a settings file from the pull request, and that file can point the tool at any web address. The tool then sends the project's secret access token to that address, so anyone who can open a pull request can steal the token.

What is Leaked secrets?

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

More by jarlob

View all

192 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.