T09 · Insecure Skill Coding Practices
- Location
scripts/restart-safe.sh:572- Finding
Arbitrary Command Execution Through Prefix-Based Command Allowlist Bypass
- Content
View full analysis
/tmp/restart-action-${task_id}-${action_id}.out 2>&1 || { log "续跑 command 执行失败(actionId=$action_id): $action_cmd" return 1 } log "续跑 command 成功(actionId=$action_id): $action_cmd" ;; ``` ### Technical Analysis The command allowlist performs only a string-prefix comparison. The built-in rules similarly accept every string beginning with values such as `echo ` or `date`. The entire accepted value is subsequently passed to `bash -lc`, which parses shell separators, pipelines, substitutions, redirections, and other shell syntax. Consequently, an untrusted command can begin with an allowed prefix and append arbitrary operations using syntax such as: ```bash echo allowed; id > command-execution-proof ``` This value matches the bu ...[truncated 1621 chars]- Remediation
View remediation
