# CVE-2021-4007: Rapid7 Insight Agent Privilege Escalation

> A local attacker can escalate to SYSTEM privileges by exploiting an uncontrolled DLL search path in Rapid7 Insight Agent.

- **Severity:** High 7.8 (`CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Local or same network only
- **Victim action needed:** Not needed
- **Fix available:** No
- **Published:** 14 Dec 2021
- **Updated:** 16 Sep 2024
- **Also known as:** GHSA-r3vg-939c-2mrm

## What is CVE-2021-4007?

CVE-2021-4007 is a high-severity vulnerability in Rapid7 Insight Agent, published on 14 Dec 2021. It can only be exploited from the same machine or local network, with no action from the victim.

### Official description

Rapid7 Insight Agent, versions 3.0.1 to 3.1.2.34, suffer from a local privilege escalation due to an uncontrolled DLL search path. Specifically, when Insight Agent versions 3.0.1 to 3.1.2.34 start, the Python interpreter attempts to load python3.dll at "C:\DLLs\python3.dll," which normally is writable by locally authenticated users. Because of this, a malicious local user could use Insight Agent's startup conditions to elevate to SYSTEM privileges. This issue was fixed in Rapid7 Insight Agent 3.1.2.35. This vulnerability is a regression of CVE-2019-5629.

Weakness: CWE-427 (Uncontrolled Search Path Element)

## Which versions are affected by CVE-2021-4007?

It affects 1 product.


Products: Rapid7 Insight Agent.

## How do I fix CVE-2021-4007?

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

## Is CVE-2021-4007 being exploited?

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

## Other vulnerabilities in Rapid7 Insight Agent

- [CVE-2026-6482](https://insights.sbomify.com/CVE-2026-6482/): Local Privilege Escalation via OpenSSL configuration file in Insight Agent (high 8.5)
- [CVE-2019-5629](https://insights.sbomify.com/CVE-2019-5629/): Privilege escalation in Insight Agent (high 7.8)
- [CVE-2026-4482](https://insights.sbomify.com/CVE-2026-4482/): Insight Agent Private Key Information Disclosure via Inherited File Permissions (medium 6.8)
- [CVE-2026-4837](https://insights.sbomify.com/CVE-2026-4837/): Eval Injection in Rapid7 Insight Agent (medium 6.6)
- [CVE-2023-2273](https://insights.sbomify.com/CVE-2023-2273/): Rapid7 Insight Agent Directory Traversal (medium 5.8)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2021-4007 and fix it if it is affected.

What it is: CVE-2021-4007 is a high-severity vulnerability in Rapid7 Insight Agent, published on 14 Dec 2021. It can only be exploited from the same machine or local network, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2021-4007 in the wild and no public exploit code.

Affected product: Rapid7 Insight Agent. 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-2021-4007/ (Markdown: https://insights.sbomify.com/CVE-2021-4007/index.md)
```

## Sources

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

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