T09 · Insecure Skill Coding Practices
- Location
SKILL.md:60- Finding
Shell Command Injection Through Unsafe User Prompt Interpolation
- Content
View full analysis
", "model": "", "prompt": "", "temperature": 0.7, "maxTokens": 4096 }' ``` The same unsafe construction pattern appears in the example: ```bash curl -s -X POST "https://oatda.com/api/v1/llm" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $OATDA_API_KEY" \ -d '{ "provider": "anthropic", "model": "claude-3-5-sonnet", "prompt": "Write a haiku about code", "temperature": 0.7, "maxTokens": 256 }' ``` ### Technical Analysis The Skill instructs an agent to insert attacker-controlled prompt content into a single-quoted shell argument. If the agent performs direct textual substitution, a prompt containing a single quote can terminate the shell argument. The remaining prompt text can then introduce shell operators and arbitrary commands. Even when command injection is not attempted, prompt content containing quotation marks, backslashes, control characters, or newlines can create malformed JSON. Shell quoting is not an appropriate JSON-escaping mechanism. The risk is amplified because the same command resolves and exports `OATDA_API_KEY` before invoking `curl`. Any injected command would execute in a process context where the API key is available. The documented credential access itself is consistent with authenticated OATDA API use and does not independently demonstrate credential harvesting; however, the injection flaw could turn that legitimate access into a credential-exfiltration path. ### Attack Path 1. An attacker supplies a text-completion request containing a si ...[truncated 1432 chars]- Remediation
View remediation
