T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:9
- Finding
- Shell Command Injection Through Unquoted Ticker Interpolation## Vulnerability Details **File Location**: `SKILL.md`, line 9 **Vulnerability Type**: OS command injection **Risk Level**: High **Vulnerable Code**: ```yaml command: "python3 yf_scraper.py {{ticker}} {{chart_flag}}" ``` ### Technical Analysis The command template places the user-derived `ticker` value directly into a command string without shell quoting, validation, or argument-boundary enforcement. If the skill runtime executes this template through a shell, shell metacharacters in the ticker are interpreted as command syntax rather than as part of a stock symbol. Although the Python script uses `argparse`, that validation occurs only after the shell has parsed the command. It therefore cannot prevent injection at the command-template layer. ### Attack Path 1. An attacker submits a ticker containing shell syntax, such as `AAPL; id > /tmp/yf-proof #`. 2. The value is interpolated into the template: ```sh python3 yf_scraper.py AAPL; id > /tmp/yf-proof # ``` 3. If the runtime invokes the resulting string through a shell, the shell runs the scraper and then executes the injected `id` command. 4. The attacker can substitute other commands to read, modify, or delete data available to the skill process, or execute locally installed programs. ### Impact Assessment Successful exploitation permits arbitrary command execution with the operating-system privileges of the Agent or skill runtime. The affected scope includes files, environment variables, credentials, network access, and other resources available to that process. This issue does not independently provide privilege escalation beyond the runtime account, but it can fully compromise that account's accessible environment.
- Remediation
- ## Remediation Suggestions - Do not execute an interpolated command through a shell. Pass arguments as a structured array, for example `["python3", "yf_scraper.py", ticker]`. - Validate the ticker before command construction using a strict allowlist appropriate to supported exchanges, such as `^[A-Za-z0-9.^-]{1,20}$`. - Represent chart selection as an internal boolean and append the fixed literal `--chart` only when needed. Do not accept arbitrary text for `chart_flag`. - If the runtime only supports string templates, apply its documented shell-safe argument mechanism rather than manually concatenating values. - Run the skill under a least-privileged account with restricted filesystem and network access to limit the impact of any command-layer vulnerability.
