T09 · Insecure Skill Coding Practices
- Location
scripts/generate_git_summary_remote.sh:136- Finding
Arbitrary Command Execution Through Unsafe eval Parameter Construction
- Content
View full analysis
/tmp/injected-command-result #' ``` The effective command evaluated by the shell contains: ```bash ".../generate_git_summary.sh" -o "...report.md" -n 1; id > /tmp/injected-command-result # ``` ### Attack Path 1. The attacker invokes the remote repository analysis script or controls arguments supplied to it. 2. The attacker places shell syntax in `--num-commits` or constructs a quote-breaking `--output` value. 3. The script appends the untrusted value to the `PARAMS` command string. 4. Line 154 passes the c ...[truncated 961 chars]- Remediation
View remediation
1000 )); then echo "Error: --num-commits must be an integer between 1 and 1000" >&2 exit 1 fi ``` Additional hardening should include: - Check that options requiring values actually have a following argument before reading `$2`. - Use `--` when passing untrusted path values to utilities that support it. - Keep all path values in quoted array elements. - Add regression tests containing semicolons, quotes, command substitutions, spaces, and newlines in argument values. ]]>
