# CVE-2026-57586: CodeRAG: Gradle Wrapper Execution During Dependency Discovery Enables Arbitrary Code Execution

> Indexing a malicious Gradle repository allows arbitrary code execution via the Gradle wrapper, impacting CodeRAG users.

- **Severity:** High 8.6 (`CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Local or same network only
- **Victim action needed:** A user has to click or open something
- **Fix available:** No
- **Published:** 15 Sep 2026
- **Updated:** 15 Sep 2026
- **Also known as:** GHSA-wg5p-8h9p-3mr7

## What is CVE-2026-57586?

CVE-2026-57586 is a high-severity command injection vulnerability in naranor agent-coderag, published on 15 Sep 2026. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

### Official description

CodeRAG is a lightweight semantic code search and distillation utility for AI coding agents. Prior to 1.3.1, the default agent-coderag sync flow in code_rag/entry/cli.py calls sync_dependencies for an indexed path, and code_rag/core/manager.py treats build.gradle or build.gradle.kts as sufficient to invoke _sync_gradle. _sync_gradle prefers a repository-controlled gradlew or gradlew.bat file and passes it directly to asyncio.create_subprocess_exec with the repository root as the working directory; validate_path in code_rag/core/utils.py constrains the directory location but does not validate the executable's content or integrity. A victim who indexes an attacker-controlled Gradle repository therefore executes attacker-supplied code with the victim's operating-system privileges, allowing disclosure, modification, persistence, or denial of service in the user environment. This issue is fixed in 1.3.1.

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

## Which versions are affected by CVE-2026-57586?

2 open source packages ship an affected version, including agent-coderag.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `agent-coderag` | PyPI | All versions | 1.3.1 |
| `agent-coderag` | PyPI | All versions | 1.3.1 |

## How do I fix CVE-2026-57586?

Upgrade agent-coderag to 1.3.1 or later.

## Is CVE-2026-57586 being exploited?

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

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-57586 and fix it if it is affected.

What it is: CVE-2026-57586 is a high-severity command injection vulnerability in naranor agent-coderag, published on 15 Sep 2026. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2026-57586 in the wild and no public exploit code.

Affected packages and fixed versions:
- agent-coderag (PyPI): affected all versions; fixed in 1.3.1
- agent-coderag (PyPI): affected all versions; fixed in 1.3.1

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

## Sources

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

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