Skip to content
Info disclosure Advisory Intermediate

GHSL-2024-253: Poisoned Pipeline Execution (PPE) via environment variable injection in Zephyr

The Zephyr documentation publishing workflow was vulnerable to environment variable injection because it loaded an artifact file into GITHUB_ENV without validating newline characters. An attacker could craft a malicious artifact to inject a BASH_ENV variable and execute arbitrary code, potentially leaking secrets and gaining write access to the repository.

Alvaro Muñoz Follow

Originally disclosed on GitHub Security Lab

Zephyr doc-publish-pr.yml workflow is vulnerable to environment variable injection which may allow an attacker to leak secrets and gain write access to the 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 workflow failed to validate that the artifact content used to set an environment variable contained no newline characters, allowing injection of additional environment variables such as BASH_ENV.

Impact

The attacker could execute arbitrary code with a GITHUB_TOKEN that has write permissions to many repository resources and could access multiple repository secrets, potentially leading to secret leakage and repository compromise.

What the attacker needed

Ability to fork the repository; Ability to create a pull request

The fix

The vulnerability was fixed by updating the workflow to properly handle the artifact content, likely by sanitising newlines or using a safer method to set the PR number.

How it was found

  1. Fork the repository and create a new branch.
  2. Modify the triggering workflow to create a malicious pr_num file with multiple lines and upload it as an artifact.
  3. Commit the change and create a pull request to the original repository.
  4. Wait for the Documentation Build workflow to finish.
  5. Observe the Documentation Publish workflow executing the injected command.

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 GitHub Actions workflow automatically runs tasks when certain events happen. This workflow downloaded a file created by a pull request and used its contents to set environment variables without checking for extra lines. An attacker could add a special line that makes the system run their own commands, giving them control over the workflow and access to sensitive data.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

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.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.