T09 · Insecure Skill Coding Practices
- Location
SKILL.md:9- Finding
Shell Command Injection Through Unquoted Ticker Interpolation
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, line 9
Vulnerability Type: OS command injection
Risk Level: HighVulnerable Code:
yaml command: "python3 yf_scraper.py {{ticker}} {{chart_flag}}"Technical Analysis
The command template places the user-derived
tickervalue 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
- An attacker submits a ticker containing shell syntax, such as
AAPL; id > /tmp/yf-proof #. - The value is interpolated into the template:
sh python3 yf_scraper.py AAPL; id > /tmp/yf-proof # - If the runtime invokes the resulting string through a shell, the shell runs the scraper and then executes the injected
idcommand. - 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.
- An attacker submits a ticker containing shell syntax, such as
- Remediation
View 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
--chartonly when needed. Do not accept arbitrary text forchart_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.
- Do not execute an interpolated command through a shell. Pass arguments as a structured array, for example
