T09 · Insecure Skill Coding Practices
- Location
SKILL.md:63- Finding
Command Injection Through Unsafe Clipboard Command Generation
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:63-67; duplicated incommands/promptify.md:52-56
Vulnerability Type: Shell command injection through unsafe interpolation of prompt-derived content
Risk Level: HighVulnerable Code (
SKILL.md:63-67):markdown ## Output 1. Optimized prompt in code block 2. `echo 'PROMPT' | pbcopy` 3. 2-3 sentence explanationVulnerable Code (
commands/promptify.md:52-56):markdown ## Output 1. Optimized prompt in code block 2. `echo 'PROMPT' | pbcopy` 3. 2-3 sentence explanationTechnical Analysis
The Skill instructs the agent to place the optimized prompt inside a single-quoted shell command. The prompt originates from user-controlled content, but neither instruction defines a shell-escaping, encoding, or validation mechanism.
A single quote in the generated prompt can terminate the intended shell string. Subsequent metacharacters can then introduce additional shell commands. Although the Skill does not execute the command itself, it presents the command as part of the expected output, making exploitation possible if a user copies and runs it.
Attack Path
- An attacker supplies prompt text containing a single quote followed by shell syntax.
- Promptify optimizes the text and inserts it into the prescribed
echo 'PROMPT' | pbcopycommand. - The generated command contains attacker-controlled syntax outside the intended quoted argument.
- The user copies and executes the command as instructed.
- The local shell interprets the injected syntax and executes it with the user's privileges.
Impact Assessment
Successful exploitation could execute arbitrary shell commands under the account of the user who runs the generated command. The resulting scope could include reading or modifying files accessible to that user, accessing environment variables and credentials, invoking network utilities, or installing user-level p ...[truncated 139 chars]
- Remediation
View remediation
Remediation Suggestions
- Do not generate executable shell commands containing prompt-derived content.
- Return the optimized prompt as plain text and direct users to copy it through their interface.
- If clipboard integration is required, use a trusted platform API that accepts data without shell parsing.
- If a shell command is unavoidable, apply a well-tested, shell-specific argument-escaping routine rather than manually adding quotes.
- Consider passing encoded content to a fixed decoder through standard input, with no user-controlled content placed in executable shell syntax.
- Add regression tests covering single quotes, command substitutions, newlines, shell metacharacters, and multiline prompts.
- Apply the same correction to both
SKILL.mdandcommands/promptify.mdto prevent inconsistent behavior.
