# CVE-2024-52587: Harden-Runner has command injection weaknesses in `setup.ts` and `arc-runner.ts`

> Command injection in Harden-Runner allows code execution via environment variables, though exploitation is unlikely due to execution order.

- **Severity:** Low 2.7 (`CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N/E:U`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 18 Nov 2024
- **Updated:** 19 Nov 2024
- **Also known as:** GHSA-g85v-wf27-67xc

## What is CVE-2024-52587?

CVE-2024-52587 is a low-severity command injection vulnerability in step-security harden-runner, published on 18 Nov 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

StepSecurity's Harden-Runner provides network egress filtering and runtime security for GitHub-hosted and self-hosted runners. Versions of step-security/harden-runner prior to v2.10.2 contain multiple command injection weaknesses via environment variables that could potentially be exploited under specific conditions. However, due to the current execution order of pre-steps in GitHub Actions and the placement of harden-runner as the first step in a job, the likelihood of exploitation is low as the Harden-Runner action reads the environment variable during the pre-step stage. There are no known exploits at this time. Version 2.10.2 contains a patch.

Weakness: CWE-78 (Improper Neutralization of Special Elements used in an OS Command)

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

1 open source package ship an affected version, including step-security/harden-runner.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `step-security/harden-runner` | GitHub Actions | All versions | 2.10.2 |

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

Upgrade step-security/harden-runner to 2.10.2 or later.

## Is CVE-2024-52587 being exploited?

There is no known exploitation of CVE-2024-52587 in the wild and no public exploit code.

## Fix prompt for AI coding agents

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

What it is: CVE-2024-52587 is a low-severity command injection vulnerability in step-security harden-runner, published on 18 Nov 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2024-52587 in the wild and no public exploit code.

Affected packages and fixed versions:
- step-security/harden-runner (GitHub Actions): affected all versions; fixed in 2.10.2

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-52587/ (Markdown: https://insights.sbomify.com/CVE-2024-52587/index.md)
```

## Sources

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

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