T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:762
- Finding
- Unvalidated Placeholders in Shell Commands## Vulnerability Details **File Location**: `SKILL.md`, lines 762–827 **Vulnerability Type**: Command injection, argument injection, and path traversal **Risk Level**: Medium ### Vulnerable Code ```bash # Move from pending to in_progress mv docs/todo/pending/{task_slug} docs/todo/in_progress/ # Add assignment signal touch docs/todo/in_progress/{task_slug}/.assigned_to_{agent} # Add start timestamp echo "$(date -Iseconds)" > docs/todo/in_progress/{task_slug}/.started_at # Create progress log touch docs/todo/in_progress/{task_slug}/progress.md # Move to blocked mv docs/todo/in_progress/{task_slug} docs/todo/blocked/ # Add blocked signals touch docs/todo/blocked/{task_slug}/.blocked echo "Reason here" > docs/todo/blocked/{task_slug}/.blocked_reason echo "$(date -Iseconds)" > docs/todo/blocked/{task_slug}/.blocked_at # Move to review mv docs/todo/in_progress/{task_slug} docs/todo/review/ # Add review signals touch docs/todo/review/{task_slug}/.ready_for_review echo "$(date -Iseconds)" > docs/todo/review/{task_slug}/.review_requested_at # Move to done mv docs/todo/review/{task_slug} docs/todo/done/ # Add completion signals touch docs/todo/done/{task_slug}/.verified echo "$(date -Iseconds)" > docs/todo/done/{task_slug}/.completed_at touch docs/todo/done/{task_slug}/.verified_by_{agent} # Move to rejected mv docs/todo/review/{task_slug} docs/todo/rejected/ # Add rejection signals touch docs/todo/rejected/{task_slug}/.rejected echo "Reason here" > docs/todo/rejected/{task_slug}/.rejected_reason echo "$(date -Iseconds)" > docs/todo/rejected/{task_slug}/.rejected_at ``` ### Technical Analysis The Skill directs an agent to interpolate `{task_slug}` and `{agent}` into shell commands without quoting or validation. If either value is derived from untrusted input and substituted verbatim, shell metacharacters may introduce additional commands, whitespace may split one intended path into several arguments, and a leading hyphen may be interpreted as a command-lin ...[truncated 1879 chars]
- Remediation
- ## Remediation Suggestions 1. Validate every task slug and agent identifier before using it in a command. Apply a strict allowlist, such as: ```bash validate_identifier() { [[ "$1" =~ ^[a-z0-9][a-z0-9_-]{0,63}$ ]] } validate_identifier "$task_slug" || { printf '%s\n' "Invalid task slug" >&2 exit 1 } ``` 2. Quote all variable expansions so each validated value remains one shell argument: ```bash mv -- "docs/todo/pending/$task_slug" "docs/todo/in_progress/" touch -- "docs/todo/in_progress/$task_slug/.assigned_to_$agent" ``` 3. Use `--` before path operands where supported to prevent identifiers beginning with a hyphen from being interpreted as options. 4. Reject absolute paths, directory separators, `.` and `..` path components, control characters, whitespace, and shell metacharacters. 5. Resolve and verify constructed paths before modification. Confirm that the canonical source and destination remain beneath the expected `docs/todo/` root. 6. Prefer a dedicated lifecycle-management script or structured filesystem API over commands assembled from textual placeholders. The script should validate inputs centrally, check expected source and destination stages, and fail safely if a target already exists. 7. Update every lifecycle example in `SKILL.md` to demonstrate validated variables and quoted path handling, preventing agents from copying the unsafe pattern.
