T09 · Insecure Skill Coding Practices
- Location
SKILL.md:229- Finding
Unvalidated User-Controlled URL Passed to a Shell-Oriented curl Fallback
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, line 229
Vulnerability Type: Command injection and server-side request forgery risk through insufficient URL validation
Risk Level: MediumVulnerable Code Snippet
markdown - If the browser can't load a page, try curl as a fallback.Technical Analysis
The skill accepts a user-provided company domain and instructs the agent to use
curlwhen browser access fails. The instruction does not require validation of the destination, restriction to public HTTP or HTTPS resources, shell-safe argument handling, or filtering of private and reserved network addresses.If an implementation constructs a shell command by directly interpolating the supplied value, shell metacharacters in a malicious “domain” could alter the command and result in command injection. Even when
curlis invoked without a shell, accepting arbitrary URLs can enable server-side request forgery against resources reachable from the agent environment, including loopback services, private network hosts, and cloud metadata endpoints.The vulnerable behavior is conditional on how the agent or runtime translates this natural-language instruction into a tool invocation. The absence of mandatory validation and safe invocation requirements nevertheless creates an exploitable unsafe execution pattern.
Attack Path
- An attacker asks the skill to analyze a crafted domain or URL.
- The supplied target is inaccessible through the browser, intentionally causing the documented fallback to be used.
- The agent follows the instruction to invoke
curlwith the attacker-controlled target. - If the target is interpolated into a shell command, shell metacharacters may inject additional commands.
- Alternatively, the target may reference or redirect to a loopback, link-local, private, or cloud metadata address.
curlexecutes the injected command or retrieves an internal resource using the agent host's network access.- Ret ...[truncated 795 chars]
- Remediation
View remediation
Remediation Suggestions
- Accept only explicitly validated
https://URLs, or normalize bare domains into HTTPS URLs after strict hostname validation. - Reject credentials in URLs, non-HTTP schemes, malformed hostnames, control characters, whitespace, and shell metacharacters.
- Resolve the hostname before making a request and block loopback, link-local, private, multicast, unspecified, and reserved IPv4 and IPv6 ranges.
- Apply the same address validation after every redirect to prevent redirect-based SSRF and DNS rebinding bypasses.
- Invoke
curlthrough a structured process API using a fixed executable and argument array rather than constructing a shell command. - Use the
--option before the URL so attacker-controlled values cannot be interpreted as command-line options. - Disable unnecessary protocols and constrain request behavior, including redirect count, connection and total timeouts, response size, and downloadable content type.
- Run network retrieval with minimal filesystem, process, credential, and network privileges.
- Replace the current instruction with explicit safe behavior, for example:
markdown - If the browser cannot load the page, use the HTTP retrieval tool or invoke curl through a structured argument array. Only fetch validated public HTTPS URLs. Never interpolate the target into a shell command, and reject redirects or resolved addresses that point to loopback, link-local, private, or reserved networks.- Accept only explicitly validated
