T09 · Insecure Skill Coding Practices
- Location
scripts/run-sandbox.sh:18- Finding
Shell Command Injection Exposes Model API Credentials
- Content
View full analysis
/dev/null || true echo "🐳 Running Claude Code in sandbox..." echo " Experiment: $EXPERIMENT_ID" echo " Directory: $EXP_DIR" echo "" docker run --rm -t \ -e ANTHROPIC_AUTH_TOKEN="$API_KEY" \ -e ANTHROPIC_BASE_URL="$BASE_URL" \ -v "$EXP_DIR":/workspace \ idea-lab-sandbox \ bash -c "cd /workspace && git init -q 2>/dev/null; claude --print --dangerously-skip-permissions \"$PROMPT\"" ``` ### Technical Analysis The prompt is obtained from command-line arguments or a file and is then interpolated directly into a string passed to `bash -c`. Shell metacharacters and embedded quotation marks in `PROMPT` are therefore interpreted by the inner shell rather than being preserved exclusively as data for Claude Code. An attacker who can influence the prompt can terminate the quoted `claude --print` argument and append arbitrary shell commands. Those commands execute inside a container that: - Receives the model API credential through `ANTHROPIC_AUTH_TOKEN`. - Receives a configurable provider URL through `ANTHROPIC_BASE_URL`. - Has outbound network access unless separately restricted. - Has read/write ...[truncated 1457 chars]- Remediation
View remediation
