T09 · Insecure Skill Coding Practices
- Location
scripts/execute-step.sh:17- Finding
Autonomous shell execution can bypass incomplete command safety filters
- Content
View full analysis
*/dev/tcp|\| *nc |\| *netcat |> */dev/udp' ENCODING_PATTERNS='base64|\\\\x[0-9a-fA-F]|\$\x27\\\\x|eval |exec |source /dev' ``` ```bash # 1. Destructive patterns (hard block — BOTH modes) if echo "$cmd" | grep -qE "$UNSAFE_PATTERNS"; then echo "BLOCKED: Destructive command pattern: $cmd" >&2 log_entry "BLOCKED destructive command: $cmd" blocked="true" fi # 2. Data exfiltration patterns if echo "$cmd" | grep -qE "$EXFIL_PATTERNS"; then log_entry "DETECTED exfiltration pattern: $cmd" if [ "$AUTONOMOUS" = "true" ]; then echo "BLOCKED: Exfiltration pattern not allowed in autonomous mode: $cmd" >&2 blocked="true" else warnings="${warnings} ⚠ EXFILTRATION: This command pipes data to an external endpoint\n" needs_confirmation="true" fi fi # 3. Encoding/obfuscation patterns if echo "$cmd" | grep -qE "$ENCODING_PATTERNS"; then log_entry "DETECTED encoding pattern: $cmd" if [ "$AUTONOMOUS" = "true" ]; then echo "BLOCKED: Obfuscated commands not allowed in autonomous mode: $cmd" >&2 blocked="true" else warnings="${warnings} ⚠ OBFUSCATION: This command uses encoding/eval patterns\n" needs_confirmation="true" fi fi ``` ```bash elif [ -n "$STEP_CMD" ]; then # Shell command execution if ! safety_check "$STEP_CMD"; then EXIT_CODE=1 echo "Command blocked by safety check" > "$STDERR_FILE" else # Execute with timeout (use gtimeout on macOS if timeout unavailable) TIMEOUT_CMD="timeout" if ! command -v timeout >/dev/n ...[truncated 3215 chars]- Remediation
View remediation
