T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:61
- Finding
- Destructive Commands Consume Unvalidated Interactive Selections## Vulnerability Details **File Location**: `SKILL.md:61-63`, `SKILL.md:184-186`, and `SKILL.md:199-201` **Vulnerability Type**: Unsafe argument handling in destructive command pipelines **Risk Level**: Medium ### Vulnerable Code ```bash # Delete selected files fzf -m | xargs rm ``` ```bash # Remove selected images docker images | fzf -m | awk '{print $3}' | xargs docker rmi ``` ```bash # Delete pods kubectl get pods | fzf -m | awk '{print $1}' | xargs kubectl delete pod ``` ### Technical Analysis These examples pass interactively selected text directly to destructive commands without robust argument boundaries, target validation, or confirmation. The file deletion pipeline uses newline-delimited output and allows `xargs` to reinterpret whitespace, quotes, backslashes, and option-like values. Consequently, a selected filename may be divided into multiple arguments or interpreted as an `rm` option. The Docker and Kubernetes examples parse human-readable tables with `awk`. Human-oriented output is not a stable machine-readable interface and includes a header row. A user can select the header or an unintended resource. The Kubernetes command also does not present or validate the active context and namespace before deletion. ### Attack Path 1. An attacker or untrusted repository introduces a filename containing whitespace, newlines, quotes, or an option-like prefix. 2. The user runs the documented multi-selection deletion workflow. 3. The crafted filename is selected in `fzf`. 4. `xargs` reparses the selection rather than preserving it as one filename. 5. `rm` receives unintended operands or options and deletes files other than the target the user expected. For Docker or Kubernetes, an operator may select an unintended row or run the command under an unexpected context or namespace. The parsed value is then passed directly to `docker rmi` or `kubectl delete pod` without an additional verification step. ...[truncated 465 chars]
- Remediation
- ## Remediation Suggestions - Preserve filename boundaries with NUL-delimited processing, such as `find ... -print0`, `fzf --read0 --print0`, and `xargs -0 -r`. - Place `--` before file operands so option-like filenames cannot be interpreted as command options. - Add a confirmation stage that displays the exact resolved targets before deletion. - Use machine-readable Docker output, for example `docker images --format`, and explicitly exclude headers. - Use structured Kubernetes output such as `kubectl get pods -o name`. - Display and validate the Kubernetes context and namespace before executing deletion. - Prefer non-destructive previews or dry-run operations where available.
