T09 · Insecure Skill Coding Practices
- Location
scripts/safe-exec.sh:175- Finding
Dangerous commands bypass approval because unknown shell syntax defaults to LOW risk
- Content
View full analysis
[[:space:]]*/dev/sd[a-z]'; then risk="critical" reason="直接写入磁盘" elif echo "$cmd" | grep -qE 'chmod[[:space:]]+777'; then risk="high" reason="设置文件为全局可写" elif echo "$cmd" | grep -qE '>[[:space:]]*/(etc|boot|sys|root)/'; then risk="high" reason="写入系统目录" elif echo "$cmd" | grep -qE '(curl|wget).*|[[:space:]]*(bash|sh|python)'; then risk="high" reason="管道下载到shell" elif echo "$cmd" | grep -qE 'sudo[[:space:]]+'; then risk="medium" reason="使用特权执行" elif echo "$cmd" | grep -qE 'iptables|firewall-cmd|ufw'; then risk="medium" reason="修改防火墙规则" fi echo "{\"risk\":\"$risk\",\"reason\":\"$reason\"}" } ``` ```bash if [[ "$risk" == "low" ]]; then log_audit "allowed" "{\"command\":$(echo "$command" | jq -Rs .),\"risk\":\"low\"}" eval "$command" exit $? fi ``` ### Technical Analysis The classifier is a denylist that initializes every command as `low`. Only a few exact textual patterns increase the risk level. Any destructive command whose spelling does not match those expressions remains LOW and is passed directly to `eval`. The regular ...[truncated 1343 chars]- Remediation
View remediation
