T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/sandbox-cmd.sh:5
- Finding
- Unauthenticated Plaintext Command-Control API## Vulnerability Details **File Location**: `scripts/sandbox-cmd.sh`, lines 5–50 **Vulnerability Type**: Unauthenticated plaintext transmission of privileged API operations **Risk Level**: High ### Vulnerable Code ```bash API_URL="http://protocol-spaces-api:3000" call_api() { local method=$1 local endpoint=$2 local extra_args=("${@:3}") local response response=$(curl -s -X "$method" "$API_URL$endpoint" "${extra_args[@]}" 2>&1) local curl_exit=$? if [ $curl_exit -ne 0 ]; then echo "{\"success\":false,\"error\":\"Cannot reach API ($curl_exit): $response\"}" return 1 fi echo "$response" } case "$ACTION" in status) result=$(call_api GET /is_sandbox_start) || { echo "false"; exit 1; } echo "$result" | jq -r '.is_running' ;; start) call_api POST /start | jq . ;; stop) call_api POST /stop | jq . ;; reset) call_api POST /reset | jq . ;; exec) if [ $# -eq 0 ]; then echo '{"success":false,"error":"No command provided"}' exit 1 fi JSON_CMD=$(jq -nc --args '$ARGS.positional' -- "$@") response=$(call_api POST /execute \ -H "Content-Type: application/json" \ -d "{\"cmd\":$JSON_CMD}") ``` ### Technical Analysis The wrapper sends sandbox lifecycle operations and arbitrary command requests to `http://protocol-spaces-api:3000`. Plain HTTP provides neither transport confidentiality nor authenticated server identity. No authorization token, client certificate, request signature, or other application-level authentication is attached to the requests. The `/execute` request may contain sensitive penetration-testing arguments, including target addresses, URLs, usernames, passwords, tokens, or other operational data. A party capable of observing the relevant network traffic can read these values. A party capable of manipulating routing, name resolution, or traffic can im ...[truncated 2429 chars]
- Remediation
- ## Remediation Suggestions 1. Replace plain HTTP with HTTPS and require strict certificate and hostname validation. 2. Prefer mutual TLS for service-to-service communication so both the client and API authenticate one another. 3. Require short-lived, narrowly scoped authorization credentials on every endpoint. Separate command-execution permission from lifecycle permissions such as `reset` and `stop`. 4. Bind the API to a private interface or local transport where feasible, and enforce firewall or network-policy restrictions so only the intended client can connect. 5. Apply server-side authorization regardless of network isolation; do not treat possession of network access as authentication. 6. Enforce sandbox isolation and least privilege on the server, including a non-root runtime, restricted Linux capabilities, resource limits, filesystem controls, and appropriate seccomp or mandatory-access-control policies. 7. Avoid passing credentials directly in command-line arguments. Use protected secret injection mechanisms and redact sensitive values from logs and errors. 8. Validate response structure and handle malformed or unauthenticated responses as failures. Authenticated response integrity should come from TLS and, where warranted, application-level signing. 9. Rotate any credentials that may previously have been transmitted over this plaintext channel after secure transport is deployed.
