Skip to content
RCE Advisory Intermediate CVE-2024-41127

GHSL-2024-167: Poisoned Pipeline Execution through Code Injection in Monkeytype - CVE-2024-41127

A GitHub Actions workflow downloaded an artifact from a triggering workflow and used its contents without validation as a number in a JavaScript script, allowing code injection. An attacker could exploit this to gain write access to pull requests.

Alvaro Muñoz Follow

Originally disclosed on GitHub Security Lab

Monkeytype is vulnerable to Poisoned Pipeline Execution through Code Injection in its ci-failure-comment.yml GitHub Workflow, enabling attackers to gain pull-requests write access.

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 was a number before interpolating it into a JavaScript script, enabling expression injection.

Impact

This issue leads to pull-requests write access.

What the attacker needed

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

The fix

The issue was fixed by a pull request.

How it was found

  1. Fork the repository and create a new branch.
  2. Modify the monkey-ci.yml workflow to write a malicious string to pr_num.txt and upload it as an artifact.
  3. Create a pull request with this change to the master branch.
  4. The modified workflow triggers, uploads the artifact, and the second workflow downloads and interpolates it into the script.

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.

This is about a GitHub Actions workflow that runs automatically when another workflow finishes. The workflow reads a file from the earlier run and inserts its content directly into a script without checking it. Because the content is not checked, an attacker can put code in that file, and the script will run it, giving the attacker extra permissions.

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

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.