T09 · Insecure Skill Coding Practices
- Location
SKILL.md:87- Finding
Shell Command Injection Through Untrusted JSON and Text Arguments
- Content
View full analysis
--menu '' ``` ```bash python3 {SKILL_DIR}/scripts/order_helper.py calorie-pairing \ --menu '' \ --nutrition-text '' \ --time-slot ``` ```bash python3 {SKILL_DIR}/scripts/order_helper.py format-order-summary \ --items '' \ --price '' \ --address '' ``` ```bash python3 {SKILL_DIR}/scripts/order_helper.py gen-pay-qr --pay-url '' ``` ### Technical Analysis The skill instructs the agent to interpolate MCP responses, menu data, nutrition text, addresses, cart contents, pricing responses, and payment URLs directly into shell commands. Wrapping a value in single quotes does not make interpolation safe if the value itself can contain a single quote. For example, a menu item, address field, nutrition entry, or remote response containing the following value can terminate the quoted argument and append a new shell command: ```text '; id > /tmp/injected # ``` The resulting command would be interpreted approximately as: ```bash python3 order_helper.py ... --menu ''; id > /tmp/injected #' ``` The Python script safely parses its arguments with `argparse`, but this occurs only after the invoking shell has parsed and executed the injected command. Therefore, the JSON parser does not mitigate this issue. The affected values originate from remote MCP responses or user-controlled order and address data. A compromised service response, malicious upstream record, or crafted user field could consequently cross the data-to-command boundary. ### Attack Path 1. An attacker causes an MCP response or user-controlled f ...[truncated 1149 chars]- Remediation
View remediation
