T09 · Insecure Skill Coding Practices
- Location
SKILL.md:41- Finding
Shell Command Injection Through Unsafe User Content Interpolation
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 41–49
Vulnerability Type: Shell command injection and unsafe JSON construction
Risk Level: HighVulnerable Code
bash curl -s -X POST https://www.vajra.to/api/analyze \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $VAJRA_API_KEY" \ -d '{"content": "URL_OR_TEXT", "type": "url"}'Set
typeto"text"for raw text (max 50,000 chars). Default is"url".Technical Analysis
The documented command places the content placeholder inside a single-quoted shell argument. The skill instructs the agent to submit arbitrary user-provided URLs or text but does not require a JSON serializer, shell-safe parameter handling, or input escaping.
If an implementation replaces
URL_OR_TEXTdirectly in this command, a single quote in attacker-controlled content can terminate the shell argument. The attacker can then introduce shell metacharacters and commands. Quotes, backslashes, control characters, and newlines can also corrupt the JSON body even when they do not achieve command execution.This issue arises from combining untrusted input, JSON encoding, and shell command construction in one interpolated string. JSON escaping alone is insufficient because shell parsing occurs independently.
Attack Path
- An attacker asks the agent to analyze a maliciously crafted URL or text value.
- The supplied value contains a single quote followed by shell syntax, conceptually:
'; ATTACKER_COMMAND; #. - The agent substitutes that value for
URL_OR_TEXTin the documentedcurlcommand. - The single quote closes the intended request-body argument.
- The shell interprets the remaining attacker-controlled text as command syntax.
- The injected command executes under the account and privileges of the agent process.
Exploitation depends on an implementation performing literal substitution into the documented shell command. Th ...[truncated 842 chars]
- Remediation
View remediation
Remediation Suggestions
-
Do not interpolate URLs or text into a shell command string.
-
Prefer a programming-language HTTP client that constructs the request body through a JSON serializer.
-
If
curlmust be used, generate the JSON separately with a serializer such asjq:bash case "$TYPE" in url|text) ;; *) printf '%s\n' "Invalid content type" >&2; exit 1 ;; esac jq -n \ --arg content "$CONTENT" \ --arg type "$TYPE" \ '{content: $content, type: $type}' | curl --fail-with-body --silent --show-error \ -X POST 'https://www.vajra.to/api/analyze' \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $VAJRA_API_KEY" \ --data-binary @- -
Keep user content in data variables and never pass the resulting command through
eval,sh -c, or another shell interpreter. -
Validate
typeagainst the strict allowlisturlandtext. -
Enforce the documented text-size limit before transmission.
-
Add tests covering single quotes, double quotes, backslashes, newlines, shell metacharacters, and Unicode input.
-
Run the skill with least privilege and restrict its filesystem, environment-variable, subprocess, and network access to reduce impact if request construction is implemented incorrectly.
-
