Summary
CodeWhale's task_create tool previously spawned durable sub-agents with insecure defaults that silently enabled unrestricted shell execution and auto-approval of actions.
Once a user approved what looked like a benign task_create request, the resulting sub-agent could issue shell commands without further consent, creating a critical remote code execution risk in the user's terminal environment.
Affected context
This vulnerability arises in CodeWhale deployments where:
- The task_create tool is used to spawn durable sub-agents.
- Default configuration values are relied upon for allow_shell and auto_approve.
- Users operate under the assumption that approval applies only to the visible, described task.
The vulnerable behavior manifests when task_create is invoked with ApprovalRequirement::Required: the user approves a seemingly limited task, but the spawned sub-agent inherits allow_shell=true and auto_approve=true, granting it hidden, ongoing shell access.
Exploit preconditions
- Attack surface: The interactive CodeWhale terminal session where task_create is available.
- Required access: Ability to initiate or influence task_create calls (e.g., through prompts, scripts, or compromised upstream instructions).
- User interaction: A user must grant approval to a task_create action they believe to be constrained or non-shell-related.
- Trigger point: Creation of a durable sub-agent via task_create, after ApprovalRequirement::Required is satisfied.
- Why exploitation is possible: The sub-agent inherits insecure defaults (allow_shell=true, auto_approve=true) that are not clearly surfaced to the user, enabling unreviewed shell command execution despite the appearance of granular approval.
Why this happens
The core issue is an unsafe default configuration and trust model, aligned with CWE-94: Improper Control of Generation of Code ('Code Injection').
The task_create pathway sets:
allow_shell.unwrap_or(true)inconfig.rs, implicitly granting shell capabilities when not explicitly overridden.auto_approve: Some(true)intask_manager.rs, allowing the sub-agent to execute actions, including shell commands, without further user confirmation.
This combination creates an environment where the agent can generate and execute shell-level "code" (commands) without explicit, ongoing user consent. The approval prompt only covers the initial task_create invocation, not the full breadth of capabilities given to the sub-agent. In abstract terms, this is a design flaw where dynamic code-execution capabilities are enabled by default and hidden behind a misleading approval boundary.
Potential impact
- The sub-agent may execute arbitrary shell commands under the user's account.
- Local files and source code repositories could be read, modified, or deleted.
- Secrets stored in environment variables, config files, or local credential stores could be exfiltrated.
- Malicious tooling or backdoors could be installed on the user's machine.
- Outbound network connections could be used for data exfiltration or staging further attacks.
- Build artifacts or releases could be tampered with, impacting downstream users (supply-chain risk).
General mitigation guidance
Effective mitigation focuses on making shell execution opt-in, explicit, and constrained, while tightening the approval model:
- Secure defaults: Configure agent and tool settings so that shell access is disabled by default (
allow_shell=false) and auto-approval is off (auto_approve=false). Require explicit, user-visible enabling of these features. - Explicit consent for shell actions: Separate approval for task creation from approval for shell execution. When shell capabilities are requested, present a clear, distinct prompt explaining the scope and risks.
- Fine-grained capability scoping: Limit what sub-agents can do even when shell is enabled—such as constraining commands, working directories, or accessible files—using policy or sandboxing mechanisms.
- Principle of least privilege: Run CodeWhale under a user or profile with minimal system privileges and restricted access to sensitive files, secrets, or production credentials.
- Configuration hardening: Encourage users and administrators to explicitly set allow_shell and auto_approve in configuration files or environment settings, rather than relying on implicit defaults.
- Auditing and visibility: Surface sub-agent capabilities and current approval state in the UI or logs so users understand which agents can execute shell commands and under what conditions.
How teams detect issues like this
Detection should focus on uncovering unsafe defaults, unexpected shell access, and silent auto-approval behavior:
- Configuration review: Regularly inspect configuration files and runtime settings for default-true flags like allow_shell and auto_approve. Flag instances where these are not explicitly set or are enabled in high-risk environments.
- Static analysis and policy checks: Use static analysis or configuration linting rules that detect patterns such as
unwrap_or(true)for security-sensitive flags, or any default-enabling of shell, network, or file-system capabilities. - Code review signals: During reviews, treat any code path that:
- Spawns durable agents or background tasks, and
- Grants them shell or code execution abilities via defaults
as high-risk. Require explicit justification and user-facing affordances (prompts, logs, controls).
- Runtime monitoring: Monitor for unexpected shell command execution originating from the CodeWhale process, especially command bursts following task_create calls. Baseline normal activity and alert on deviations.
- Automated tooling: Integrate security linters and CI checks that flag insecure default values and missing explicit consent flows for powerful capabilities like shell execution.

