T09 · Insecure Skill Coding Practices
- Location
SKILL.md:135- Finding
Shell command injection through unescaped prompt interpolation
- Content
View full analysis
","duration":10,"aspect_ratio":"9:16","resolution":"720p","generate_audio":true}' ``` The API documentation similarly instructs callers to place prompt data directly inside a shell command: ```sh node {baseDir}/scripts/video_gen.js wait --json '{"model":"KLING_V3_0_PRO","prompt":"...","duration":5,"aspect_ratio":"9:16"}' node {baseDir}/scripts/video_gen.js wait --json '{"model":"...","prompt":"...","image":"https://...","duration":5}' node {baseDir}/scripts/video_gen.js wait --json '{"model":"...","prompt":"...","image":"./girl.png","duration":5}' node {baseDir}/scripts/video_gen.js wait --json '{"model":"...","prompt":"...","images":["https://..."],"duration":5}' node {baseDir}/scripts/video_gen.js wait --json '{"model":"...","prompt":"...","images":["./frame-1.png","./frame-2.png"],"duration":5}' node {baseDir}/scripts/video_gen.js wait --json '...' --dry-run ``` ### Technical Analysis The Skill requires an agent to expand user-controlled text into a production prompt and then execute a documented command in which the JSON is enclosed by single shell quotes. No instruction requires shell-safe encoding, and the CLI offers no stdin-based JSON input. JSON escaping does not provide shell escaping. If the generated prompt contains a single quote, that character terminates the shell-quoted argument. Subsequent prompt content can then be interpreted as shell operators or commands. The JavaScript program itself parses `process.argv` without invoking a shell. The vulnerability arises when an agent follows the documented invocation by constructing a command string and executing it through a shell. Conseque ...[truncated 1198 chars]- Remediation
View remediation
