Skip to content
RCE Advisory Intermediate

GHSL-2026-207: Arbitrary code execution in kptdev/kpt's SonarCloud workflow via external pull requests

The SonarCloud analysis workflow copied an external pull request's head branch name into a step output and then interpolated that output directly into an inline Bash script. An external pull request author could use shell command-substitution syntax in the branch name to execute arbitrary commands in the base repository's workflow_run job, potentially capturing the SONAR_TOKEN used by a later step.

jarlob Follow

Originally disclosed on GitHub Security Lab

The SonarCloud analysis workflow copies an external pull request’s attacker-controlled head branch name into a step output and directly interpolates that output into an inline Bash script. An external pull request author can use shell command-substitution syntax in the branch name to execute arbitrary commands in the…

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

Impact

An external fork pull request author could execute arbitrary shell commands in a base-repository workflow_run job and potentially capture or misuse the SONAR_TOKEN given to a later step, though exploitation required the Go workflow to succeed, the expected artifacts to exist, and SONAR_TOKEN to be configured.

What the attacker needed

Control of an external fork branch name; Go workflow completes successfully; expected artifacts exist; SONAR_TOKEN configured

The fix

The issue was fixed in pull request #4780.

How it was found

  1. An external contributor creates a fork branch whose name contains command-substitution syntax and opens a pull request that triggers the Go workflow.
  2. The pull request workflow completes successfully and uploads its coverage and PR_NUMBER artifacts.
  3. The workflow_run workflow retrieves the pull request and propagates its attacker-controlled head branch name through the pr_meta output.
  4. The debug step inserts the value into the generated Bash script, executing the embedded command on the sonarqube runner.
  5. The injected process can alter runner or workspace state before the later SonarQube scan step receives SONAR_TOKEN.

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 can pass data between steps using outputs. If a workflow takes a value that an outsider controls, such as a branch name, and puts it straight into a shell script, the shell may treat parts of that value as commands. Here, a branch name containing special shell syntax could run commands on the build server and reach a secret used later in the same job.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

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.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.