T09 · Insecure Skill Coding Practices
- Location
SKILL.md:452- Finding
Shell Command Injection Through AI-Generated JSON and Unquoted Paths
- Content
View full analysis
' | python3 /srl_analyzer.py > /path/to/target-skill/.srl-report.md echo '' | python3 /srl_analyzer.py --json > /path/to/target-skill/.srl-report.json ``` The same unsafe command-construction pattern also appears in `SKILL.md` at lines 421 and 424. ### Technical Analysis The documented workflow instructs the agent to place generated JSON directly inside a single-quoted shell command. That JSON contains fields derived from the audited Skill, including its description, evidence, paths, and other potentially attacker-controlled content. A single quote in the generated data terminates the shell string. Any shell syntax following that quote is then interpreted as a command rather than JSON data. JSON does not escape apostrophes because they have no special meaning in JSON strings, so ordinary JSON serialization does not prevent this issue. For example, attacker-controlled Skill content resembling the following could be incorporated into a generated JSON field: ```text '; id > /tmp/srl-command-injection-proof; # ``` If inserted into the documented command, the shell can interpret it as: ```bash echo '{"description":"'; id > /tmp/srl-command-injection-proof; # ...' ``` The `id` command would execute with the privileges of the agent running the evaluation. The script path and output path placeholders are also unquoted. If an attacker can influence the target path and that path contains whitespace or shell metacharacters, substituting it directly into the command creates an additional command-injection and argument-confusion vector. The Python implementation itself does not invoke a shell or subprocess. The vulnerability is in the Skill instructions that direct the agent to construct and execute unsafe shell c ...[truncated 1882 chars]- Remediation
View remediation
