T09 · Insecure Skill Coding Practices
- Location
metadata.json:11- Finding
Command Injection Through Unquoted Tool Parameters
- Content
View full analysis
Vulnerability Details
File Location:
metadata.json, lines 11–16
Vulnerability Type: Command injection through unsafe command-template interpolation
Risk Level: HighVulnerable Code
json "command": "python zodiac_api.py zone {{sign}}" }, { "name": "get_pairing_details", "description": "Fetch in-depth destiny-style romantic compatibility report, score, and relationship guide for two 48 Zodiac signs. Parameters 'sign1' and 'sign2' accept either 48-Zodiac IDs or birthdate strings (e.g., '05-09', '5/9'). The API resolves them automatically.", "command": "python zodiac_api.py pairing {{sign1}} {{sign2}}"Technical Analysis
The tool definitions directly interpolate the user-controlled
sign,sign1, andsign2parameters into command strings without validation, shell escaping, or an argument-array execution mechanism.If the Skill framework executes these templates through a command shell, shell metacharacters embedded in a parameter can alter the intended command structure. For example, an attacker could supply a value containing a command separator such as
;, causing the shell to execute an additional command rather than treating the entire value as a zodiac identifier.The URL encoding in
zodiac_api.pydoes not mitigate this issue. Shell parsing occurs before Python receives the arguments, whereas URL encoding is only applied after the Python process starts.Attack Path
- An attacker supplies a crafted zodiac parameter containing shell syntax through
sign,sign1, orsign2. - The Skill framework substitutes the value directly into the corresponding
commandtemplate. - If the framework invokes the resulting string through a shell, the shell interprets the injected metacharacters.
- The intended Python command runs, and the injected command is executed separately with the privileges of the Agent or Skill runner.
- The injected command may access local file ...[truncated 1116 chars]
- An attacker supplies a crafted zodiac parameter containing shell syntax through
- Remediation
View remediation
Remediation Suggestions
-
Replace string-based command execution with a structured argument-array interface that does not invoke a shell, for example:
json { "executable": "python", "args": ["zodiac_api.py", "zone", "{{sign}}"] }Apply the equivalent structure to the pairing command.
-
Validate every parameter before execution. Permit only explicitly supported formats, such as:
- Zone IDs: a tightly constrained allowlist or pattern such as lowercase zodiac names followed by an expected zone number.
- Dates: numeric month-day formats with valid calendar ranges.
-
Reject whitespace, control characters, command separators, redirection operators, substitutions, and other unexpected characters.
-
If the framework only supports command strings, use its documented native argument-escaping mechanism. Simple manual quoting is not sufficient across all shells and platforms.
-
Add tests containing shell metacharacters and malformed values to confirm that inputs are either rejected or passed as one literal argument.
-
Run the Skill under a restricted account with minimal filesystem access, a sanitized environment, and outbound network access limited to the declared zodiac API endpoint.
-
