# CVE-2024-41127: Code injection in monkeytype

> Attackers can inject code into a GitHub workflow to gain write access to pull requests in the Monkeytype typing test application.

- **Severity:** High 8.4 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** No
- **Published:** 2 Aug 2024
- **Updated:** 2 Aug 2024
- **Also known as:** GHSA-wcjf-5464-4wq9

## What is CVE-2024-41127?

CVE-2024-41127 is a high-severity code injection vulnerability in monkeytypegame monkeytype, published on 2 Aug 2024. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

Monkeytype is a minimalistic and customizable typing test. 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. The ci-failure-comment.yml workflow is triggered when the Monkey CI workflow completes. When it runs, it will download an artifact uploaded by the triggering workflow and assign the contents of ./pr_num/pr_num.txt artifact to the steps.pr_num_reader.outputs.content WorkFlow variable. It is not validated that the variable is actually a number and later it is interpolated into a JS script allowing an attacker to change the code to be executed. This issue leads to pull-requests write access. This vulnerability is fixed in 24.30.0.

Weakness: CWE-94 (Improper Control of Generation of Code), CWE-74 (Improper Neutralization of Special Elements in Output Used by a Downstream Component)

## Which versions are affected by CVE-2024-41127?

It affects 1 product.


Products: Monkeytype Monkeytype.

## How do I fix CVE-2024-41127?

No fix has been published for CVE-2024-41127 yet. Limit exposure of the affected software until one is available.

## Is CVE-2024-41127 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-41127 exists.

Public exploit code:

- Authorized security-research lab reproducing CVE-2024-41127 (GHSA-wcjf-5464-4wq9): poisoned pipeline execution via artifact-controlled code injection in ci-failure-comment.yml. Snapshot of monkeytypegame/monkeytype @ deeea0f. (github_poc): https://github.com/pvharmo2/gha-lab-83342297e0

## Other vulnerabilities in monkeytypegame monkeytype

- [CVE-2025-66563](https://insights.sbomify.com/CVE-2025-66563/): Monkeytype vulnerable to stored XSS in approve quotes page (high 7.1)
- [CVE-2025-59838](https://insights.sbomify.com/CVE-2025-59838/): Monkeytype Vulnerable to Self-XSS on loading saved custom text (low 2.4)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-41127 and fix it if it is affected.

What it is: CVE-2024-41127 is a high-severity code injection vulnerability in monkeytypegame monkeytype, published on 2 Aug 2024. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-41127 exists.

Affected product: monkeytypegame monkeytype. No package-level version data is available, so check the vendor advisory linked from the reference page.

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2024-41127/ (Markdown: https://insights.sbomify.com/CVE-2024-41127/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2024-41127
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2024-41127
- OSV: https://osv.dev/vulnerability/CVE-2024-41127

---
From sbomify Insights: https://insights.sbomify.com/CVE-2024-41127/
Summaries are generated and may contain mistakes; the official description above is the record.
