Skip to content
RCE Advisory Intermediate

GHSL-2024-173: Environment Variable injection in a Feign GitHub Actions workflow

The comment-pr.yml workflow reads an unvalidated pr_number.txt file into environment variables, allowing an attacker to inject LD_PRELOAD and execute arbitrary code when a subsequent action runs node. This could lead to repository takeover with a GITHUB_TOKEN that has write permissions.

ghsecuritylab Follow

Originally disclosed on GitHub Security Lab

Feign’s comment-pr.yml workflow is vulnerable to Environment Variable injection which may lead to Repository takeover.

ghsecuritylab, 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

This issue may lead to repository takeover since it will grant an attacker a GITHUB_TOKEN with write permissions to actions, contents, packages, and more.

What the attacker needed

Ability to create a pull request; maintainer approval of receive-pr workflow

How it was found

  1. Clone the repository and edit the receive-pr workflow to create a malicious pr_number.txt and download a shared library.
  2. Create a pull request with this change, which triggers the modified receive-pr workflow.
  3. Upon completion, the receive-pr workflow triggers the vulnerable comment-pr workflow.
  4. The comment-pr workflow downloads the artifact and reads pr_number.txt into environment variables, injecting LD_PRELOAD.
  5. A subsequent step runs googleapis/code-suggester, which executes node and loads the malicious library, executing arbitrary code.

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 is an automated script that runs on GitHub. This workflow took a file from an untrusted source and used its contents to set environment variables without checking them. An attacker could sneak in extra settings that make the system run their own code, potentially taking over the repository.

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 ghsecuritylab

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.

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.