Summary
CodeWhale versions in the affected release range allow the exec_shell_interact tool to treat an interactive shell as automatically approved, bypassing the approval normally required for code-executing tools. If an attacker can inject instructions through content ingested by the agent, commands may run through an already-approved session with that process's privileges.
Affected context
The vulnerability occurs in CodeWhale deployments that expose the exec_shell_interact or exec_interact tool and permit the agent to interact with long-running shell processes. It becomes risky when untrusted content can influence agent instructions and an interactive process, such as a Python REPL, database client, SSH session, or elevated shell, has already been approved.
Exploit preconditions
- Attack surface: CodeWhale's interactive shell execution tool
- Required access: Ability to influence content consumed by the agent, such as fetched pages, MCP results, or repository files
- Trigger point: LLM-controlled input is written to an already-approved long-running interactive shell
- Why exploitation is possible: The tool reports automatic approval instead of requiring approval for each code-executing interaction, allowing injected instructions to reuse the privileges of the approved process
Why this happens
The underlying issue is an authorization-state error in the tool's approval policy. The approval_requirement implementation returns an automatic-approval result for an interactive execution capability that should retain the default required-approval behavior.
This maps to CWE-269: Improper Privilege Management, because the system permits agent-controlled actions to inherit the authority of an approved process without sufficiently rechecking whether each subsequent command or input is authorized. The insecure pattern is treating approval for a long-running session as approval for all future commands sent to that session.
Potential impact
- Commands may execute with the privileges of the approved interactive process
- An attacker could alter files, access data, or modify application state
- An elevated shell session could enable broader system compromise
- Database, remote-host, or repository operations could be performed without an additional approval prompt
- Agent-integrated workflows could be abused through indirect prompt injection
General mitigation guidance
Mitigation generally focuses on preserving authorization boundaries for every code-executing interaction.
Common defensive patterns include:
- Require explicit approval for interactive shell input, including subsequent writes to an existing session
- Avoid treating approval of a process launch as approval for all commands executed within that process
- Separate untrusted agent content from privileged execution channels
- Use allowlists for permitted tools, commands, destinations, and session types
- Run agent-controlled processes with the minimum required operating-system and service privileges
- Prefer isolated, short-lived execution environments for tasks that process untrusted content
- Apply confirmation and policy checks before interactions with elevated shells, remote systems, databases, or credential-bearing sessions
- Record and review approval decisions, session commands, and tool-call provenance
How teams detect issues like this
Detection approaches can include:
- Static analysis for approval handlers that return automatic approval for code-executing or interactive tools
- Code review checks verifying that each interactive command or stdin write is independently authorized
- Tests that place an approved long-running process behind the normal approval policy and confirm later inputs still require authorization
- Policy enforcement preventing agent-controlled content from directly reaching privileged shell sessions
- Runtime monitoring for unexpected tool calls, shell input, privilege transitions, remote connections, or database activity following ingestion of external content
- Automated security review tools configured to flag approval-state reuse and missing authorization checks

