Advisory

GHSA-gx45-xrj5-g6c4

Details, part 2 of 2. The advisory

Details

  • Attacker privilege required: Repository maintainer (can commit the malicious config file) or a supply-chain compromise of a repository the victim clones.
  • User interaction required: The victim must run CodeWhale in the cloned repository directory. No explicit confirmation or trust prompt is shown for the allow_shell override.
  • Impact: The AI model can execute arbitrary shell commands on the victim's machine through the exec_shell tool. Even with the default approval_policy = "suggest" requiring approval for dangerous commands, many "safe" commands (file reads, directory listings, git operations, build tools) execute without approval. Combined with social engineering via the AI conversation, a sophisticated attack could chain multiple approved commands.
  • Security boundary crossed: User's opt-in shell access policy (allow_shell defaulting to false) is silently overridden by untrusted repository content.

Suggested remediation

  1. Add `allow_shell` to the `DENY_AT_PROJECT_SCOPE` list at crates/tui/src/main.rs:5119:
   const DENY_AT_PROJECT_SCOPE: &[&str] = &["api_key", "base_url", "provider", "mcp_config_path", "allow_shell"];

And emit a warning when it is encountered in project config, matching the existing pattern for other denied keys.

  1. Alternatively, apply the same tightening-only guard used for approval_policy:
   if let Some(v) = table.get("allow_shell").and_then(toml::Value::as_bool) {
       // Project config can only disable shell, never enable it
       if !v {
           config.allow_shell = Some(false);
       } else {
           eprintln!(
               "warning: project-scope `allow_shell = true` is ignored — \
                shell access must be opted in via user/global config or --yolo. \
                (See #417.)"
           );
       }
   }
  1. Regression test: Add a test confirming that allow_shell = true in a project config is rejected/ignored:
   #[test]
   fn project_overlay_cannot_enable_allow_shell() {
       let tmp = workspace_with_project_config("allow_shell = true\n");
       let mut config = Config::default();
       merge_project_config(&mut config, tmp.path());
       assert!(
           !config.allow_shell(),
           "project config must not be able to enable shell access"
       );
   }

CVE

Credits

  • Thai Son Dinh from VinSOC Labs (R&D)
  • Nguyen Huy Vu Dung from VinSOC Labs (AppSec)

Sources & licences