T09 · Insecure Skill Coding Practices
- Location
SKILL.md:114- Finding
Unrestricted URL Fetching Enables Server-Side Request Forgery
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 114–119
Vulnerability Type: Server-Side Request Forgery (SSRF) through unrestricted URL fetching
Risk Level: HighVulnerable Code
python def fetch_headers(url: str) -> dict[str, str]: """Fetch HTTP response headers from URL.""" result = subprocess.run( ['curl', '-sI', url, '--max-time', '10', '-L', '--user-agent', 'SecurityHeaderAuditor/1.0'], capture_output=True, text=True )Technical Analysis
The Skill passes a user-controlled URL directly to
curlwithout validating its scheme, hostname, resolved IP address, port, or redirect destinations. Becausecurlis executed with-L, an attacker-controlled public URL can redirect the request to a loopback, private, link-local, or cloud metadata address.The documentation also explicitly supports
http://localhost:3000, confirming that access to services on the Agent's local network is intentional but unrestricted. Local development support may be legitimate, but exposing it to arbitrary requesters exceeds least privilege unless authorization and destination controls are enforced.The use of an argument array in
subprocess.runprevents conventional shell metacharacter injection. The confirmed issue is SSRF and network-boundary bypass, not shell command injection.The request sends a fixed User-Agent and ordinary HTTP request metadata. No deliberate transmission of local credentials, environment variables, files, or secrets was identified. Nevertheless, automatically attached network credentials or infrastructure-specific headers may still be exposed depending on the execution environment and proxy configuration.
Attack Path
- An attacker requests an audit of an internal address, such as a loopback service, private network host, or cloud metadata endpoint.
- Alternatively, the attacker supplies a public URL under their control that redirects to an internal destination.
- The Ag ...[truncated 1286 chars]
- Remediation
View remediation
Remediation Suggestions
- Parse input URLs with a strict URL parser and permit only explicitly required schemes, preferably
httpsand optionallyhttp. - Reject URLs containing embedded credentials, malformed authorities, unsupported ports, or ambiguous host representations.
- Resolve the hostname before connecting and reject every address in loopback, private, link-local, multicast, reserved, unspecified, and cloud-metadata ranges.
- Revalidate the resolved address at connection time to mitigate DNS rebinding and time-of-check/time-of-use issues.
- Disable automatic redirects where possible. If redirects are required, validate the scheme, hostname, port, and resolved address of every redirect target before following it.
- Make localhost and private-network auditing an explicit privileged mode that requires authorization rather than enabling it for arbitrary requests.
- Apply an outbound network policy that blocks metadata endpoints and internal ranges by default.
- Use an allowlist of approved domains when the operating context permits it.
- Restrict destination ports to those required for HTTP security-header auditing.
- Return a clear validation error without including sensitive internal resolution or connectivity details.
- Parse input URLs with a strict URL parser and permit only explicitly required schemes, preferably
