T09 · Insecure Skill Coding Practices
- Location
SKILL.md:59- Finding
Shell Command Injection Through an Untrusted News Search Keyword
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 59–65 and 108
Vulnerability Type: Shell command injection
Risk Level: HighThe Skill repeatedly instructs the Agent to place a user-provided search keyword inside a shell command. The relevant command pattern, rendered with an English placeholder, is:
bash gnomic news search "<user-supplied keyword>"The same unsafe pattern is prescribed in the command-selection table:
text Search for a topic or keyword: gnomic news search "<user-supplied keyword>"Technical Analysis
The keyword originates from the user's request and is therefore untrusted. If the Agent constructs the documented command as a string and submits it to a shell, surrounding the keyword with double quotes is not sufficient shell escaping.
In common POSIX shells, command substitution using
$()or backticks remains active inside double-quoted strings. Depending on how substitution is implemented, quote characters and shell metacharacters in the input may also terminate the intended argument and append additional commands.For example, a malicious keyword conceptually containing
$(attacker_command)can cause the shell to executeattacker_commandwhile preparing the argument passed tognomic. This occurs before or alongside execution of the legitimate news-search operation.The vulnerability is conditional on the Agent using a shell command string and directly substituting the keyword, but that is the execution pattern encouraged by the Skill's fenced shell examples.
Attack Path
- An attacker asks the Agent to search for news using a keyword containing shell command-substitution syntax or quote-breaking metacharacters.
- The Agent follows
SKILL.mdand replaces the documented keyword placeholder with the attacker-controlled value. - The Agent submits the resulting command string to a shell.
- The shell interprets the injected syntax rath ...[truncated 903 chars]
- Remediation
View remediation
Remediation Suggestions
-
Do not construct a shell command by interpolating the keyword into a command string.
-
Invoke the executable through an argument-array API that bypasses shell parsing, for example:
javascript execFile("gnomic", ["news", "search", keyword], callback); -
If the Agent platform exposes a structured process-execution tool, pass
gnomic,news,search, and the keyword as separate arguments. -
Explicitly state in the Skill that the keyword must never be evaluated through
sh -c,bash -c, or an equivalent shell. -
Apply reasonable length limits and reject NUL bytes and control characters as defense in depth.
-
Do not rely solely on allowlisting ordinary language characters, because legitimate news keywords may contain broad Unicode content.
-
If shell execution is unavoidable, use a well-tested, platform-specific argument-escaping library rather than manual quoting.
-
