T09 · Insecure Skill Coding Practices
- Location
SKILL.md:102- Finding
Shell and JSON Injection Through Unescaped Dialogue Content
- Content
View full analysis
", "messages": [ {"role": "system", "content": ""}, {"role": "user", "content": "Question: \n\nPrevious speeches:\n\n\nGive your speech."} ], "temperature": 0.8, "max_tokens": 1500 }' ``` ### Technical Analysis The instructions place the user-controlled question and model-generated previous speeches directly inside a single-quoted shell argument. No JSON serialization, shell escaping, or safe parameter-passing mechanism is specified. If an agent implements this template through direct textual substitution, an input containing a single quote can terminate the shell argument. The remainder of the input can then be interpreted as shell syntax. Independently, unescaped quotation marks, backslashes, or control characters can corrupt the JSON request. This issue affects both: - ``, which is directly controlled by the user. - ``, which contains externally generated model output and therefore must also be treated as untrusted. ### Attack Path 1. An attacker invokes the Skill with a philosophical question containing a single quote followed by shell syntax. 2. The agent directly replaces `` in the documented `curl` command. 3. The single quote terminates the `-d` shell argument. 4. The injected shell metacharacters cause an additional command to execute. 5. That command runs with the same local privileges and environment as the agent's Bash tool. 6. The injected command may read accessible files, modify the working directory, or send environment variables such as `OPENROUTER_API_KEY` to ...[truncated 807 chars]- Remediation
View remediation
request.json curl --fail-with-body --silent --show-error \ https://openrouter.ai/api/v1/chat/completions \ -H "Authorization: Bearer $OPENROUTER_API_KEY" \ -H "Content-Type: application/json" \ --data-binary @request.json ``` ]]>
