CodeWhale: run_tests Tool Enables RCE via Malicious Repository Without Approval
CodeWhale is a DeepSeek + MiMo coding agent in terminal. From 0.3.0 to 0.8.23, the run_tests tool executes cargo test in the workspace with ApprovalRequirement::Auto, meaning it runs without any user approval prompt. cargo test compiles and executes arbitrary code: test binaries, build.rs build scripts, and proc macros. While auto-approving test execution is a deliberate design choice, it creates an inconsistency in the security boundary. However, in a malicious repository, test code can execute arbitrary shell commands, exfiltrate credentials, or establish persistence with zero approval. The attack is amplified by AGENTS.md (auto-loaded into the system prompt), which can instruct the model to run tests proactively at session start. This vulnerability is fixed in 0.8.23.
Problem Types
| Type | CWE ID | Description |
|---|
| CWE | CWE-94 | CWE-94: Improper Control of Generation of Code ('Code Injection') |
Type: CWE
Description: CWE-94: Improper Control of Generation of Code ('Code Injection')
Metrics
| Version | Base score | Base severity | Vector |
|---|
| 3.1 | 9.6 | CRITICAL | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H |
Version: 3.1
Base score: 9.6
Base severity: CRITICAL
Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H