Summary
CodeWhale's rlm_eval tool can execute model-supplied Python code without consulting the user's configured approval policy or displaying an approval prompt. If the agent processes attacker-controlled content, such as a web page, repository file, fetched URL, or MCP result, prompt injection may cause arbitrary code to run on the user's machine with the agent's privileges.
Affected context
The vulnerability affects CodeWhale deployments using the rlm_eval tool in versions where its approval behavior is treated as automatic execution. The risk arises when an agent reads untrusted external or local content and that content can influence model-generated tool activity. The companion rlm_open tool may provide a path for staging content that is subsequently processed by the agent.
Exploit preconditions
- Attack surface: Agent tool execution through
rlm_eval - Required access: The attacker generally needs to influence content the agent will read, such as a web resource, repository file, or MCP tool response
- Trigger point: The agent processes attacker-controlled content and invokes
rlm_eval - Why exploitation is possible: The tool reports an automatic approval requirement, so the engine may execute model-supplied Python code without applying the user's approval policy, confirmation prompt, or audit step
Why this happens
The underlying flaw is an unsafe authorization decision in the tool's approval integration. By returning an automatic-execution requirement, rlm_eval causes the engine to treat code execution as exempt from interactive approval and configured policy checks.
This behavior maps to CWE-94: Improper Control of Generation of Code ('Code Injection'), because attacker-influenced content can affect the generation and execution of Python code in a privileged local process. The insecure pattern is trusting model-generated tool actions without preserving the intended authorization, review, and audit boundary.
Potential impact
- Arbitrary Python code may execute on the user's machine
- The process may access resources available to the user's account
- Local files, credentials, or environment data could be exposed or altered
- The attacker could establish persistence or affect other development resources
- Source code, repositories, or connected services could be modified
- The incident could facilitate further compromise through the agent's permissions
General mitigation guidance
Mitigation generally focuses on preserving approval and authorization controls around code-executing tools.
Common defensive patterns include:
- Require explicit approval for code execution, rather than treating execution as automatically authorized
- Ensure configured approval policies are enforced consistently by the execution engine
- Present clear prompts and record auditable decisions before running model-supplied code
- Treat web content, repository files, fetched data, and MCP results as untrusted input
- Restrict agent processes with least-privilege accounts, isolated environments, and limited filesystem and network access
- Separate content retrieval from code execution and apply policy checks at the final execution boundary
- Use allowlists or constrained interpreters for workflows that do not require general-purpose Python execution
How teams detect issues like this
Organizations can look for:
- Static analysis and code review rules that flag tools declaring automatic approval for code execution
- Tests verifying that configured approval policies are consulted before every execution path
- Review signals involving model-generated Python, shell, or other interpreter input
- Audit records showing code execution without an associated approval decision
- Policy enforcement that blocks unrestricted interpreter access from agent processes
- Runtime monitoring for unexpected child processes, filesystem changes, network connections, or credential access
Automated security review tools may help identify inconsistent authorization handling and execution paths that bypass confirmation controls.

