T09 · Insecure Skill Coding Practices
- Location
SKILL.md:762- Finding
Unvalidated Placeholders in Shell Commands
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 762–827
Vulnerability Type: Command injection, argument injection, and path traversal
Risk Level: MediumVulnerable 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_atTechnical 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
View remediation
Remediation Suggestions
-
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 } -
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" -
Use
--before path operands where supported to prevent identifiers beginning with a hyphen from being interpreted as options. -
Reject absolute paths, directory separators,
.and..path components, control characters, whitespace, and shell metacharacters. -
Resolve and verify constructed paths before modification. Confirm that the canonical source and destination remain beneath the expected
docs/todo/root. -
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.
-
Update every lifecycle example in
SKILL.mdto demonstrate validated variables and quoted path handling, preventing agents from copying the unsafe pattern.
-
