Executive brief
CodeRAG is a semantic code search tool used by developers to analyze and index code repositories. When scanning a Gradle-based Java project, the tool automatically runs build scripts (gradlew) from the repository without verifying their authenticity. An attacker can trick a developer into indexing a malicious repository containing a compromised build script, which would execute the attacker's code with the developer's system privileges, potentially stealing credentials, modifying files, or installing malware.
Technical details
This is an arbitrary code execution vulnerability caused by insufficient validation of executable files during Gradle dependency resolution. When CodeRAG detects a build.gradle or build.gradle.kts file, it invokes the local gradlew or gradlew.bat script via asyncio.create_subprocess_exec without validating the script's integrity or origin. The validate_path function in code_rag/core/utils.py only checks directory location constraints, not executable content. An attacker who controls a Git repository can place a malicious gradlew script that executes during the dependency sync phase. The fix, released in version 1.3.1, restricts execution to only system-installed gradle binaries from PATH, eliminating repository-local script execution.
Affected products
- naranor CodeRAG prior to 1.3.1
Timeline
- 2026-09-15: disclosed
- 2026-06-18: patched: Version 1.3.1 released with security patch