T09 · Insecure Skill Coding Practices
- Location
SKILL.md:22- Finding
Unrestricted URL Retrieval Enables Server-Side Request Forgery and Potential Command Injection
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 22-31
Vulnerability Type: Unvalidated external URL handling and unsafe command construction
Risk Level: Highpowershell Invoke-WebRequest -Uri "URL" -OutFile "$env:TEMP\paper.pdf"Technical Analysis
The Skill directs the agent to insert a user-provided URL into a PowerShell command and download its content with
Invoke-WebRequest. The documented validation only requires an HTTP or HTTPS URL. It does not restrict destination hosts, resolved IP addresses, ports, redirects, or embedded credentials.Consequently, an attacker could provide URLs targeting loopback addresses, private network ranges, link-local services, or cloud instance metadata endpoints. Because the downloaded response is subsequently opened and processed as a PDF, content retrieved through the agent may be incorporated into generated output or error messages.
The command is also represented through textual substitution inside a quoted PowerShell command. If the implementation replaces
URLdirectly without safe parameter binding, a URL containing a quote followed by PowerShell syntax could terminate the argument and inject an additional command. The feasibility of command injection depends on how the agent constructs and invokes the documented command, but the instructions provide no escaping or validation requirements.Attack Path
- An attacker asks the Skill to process a crafted HTTP or HTTPS URL.
- The URL targets an internal service, loopback interface, private address, link-local address, or cloud metadata endpoint.
- The agent executes
Invoke-WebRequestfrom its own network context. - PowerShell retrieves data that the attacker could not access directly and stores it as the temporary PDF.
- The Skill attempts to parse, translate, or report errors concerning the retrieved response, potentially exposing internal information through generated output.
- If direct ...[truncated 829 chars]
- Remediation
View remediation
Remediation Suggestions
- Parse the supplied URL with a dedicated URL parser rather than inserting raw input into command text.
- Permit only explicitly supported schemes, normally
https. - Reject URLs containing user-information components, ambiguous host representations, or unsupported ports.
- Resolve the hostname before downloading and reject loopback, private, link-local, multicast, reserved, and unspecified IPv4 and IPv6 addresses.
- Explicitly deny known cloud metadata destinations.
- Revalidate every redirect target and apply a conservative redirect limit.
- Consider an allowlist of trusted academic publication domains when operationally feasible.
- Pass the validated URL as a bound process argument or PowerShell parameter; never construct a shell command through direct string interpolation.
- Download through a restricted client with connection, response-size, and execution-time limits.
- Verify that the response is a valid PDF using both content checks and parser validation before further processing.
- Run network retrieval and PDF parsing in a sandbox without sensitive credentials and with restricted internal-network access.
