T09 · Insecure Skill Coding Practices
- Location
scripts/main.py:662- Finding
Unrestricted URL Retrieval Enables Server-Side Request Forgery and Local Resource Access
- Content
View full analysis
Vulnerability Details
File Location:
scripts/main.py:662-669
Vulnerability Type: Server-Side Request Forgery (SSRF) and unsafe URL scheme handling
Risk Level: Highpython elif args.url: try: import urllib.request with urllib.request.urlopen(args.url, timeout=30) as response: text = response.read().decode('utf-8') except Exception as e: print(f"Error fetching URL: {e}", file=sys.stderr) sys.exit(1)Technical Analysis
The value of
args.urlis supplied directly tourllib.request.urlopen()without validating its scheme, hostname, port, resolved IP address, or redirect destination. Python's URL handling may support non-HTTP schemes such asfile:, while HTTP requests may target loopback, private, link-local, reserved, or cloud metadata addresses.A timeout only limits request duration; it does not prevent access to unauthorized resources. Redirects are also followed without revalidating the destination. The response body is read without a size limit and is subsequently processed as attacker-selected document content.
Attack Path
- An attacker causes the Skill or its invoking Agent to process an attacker-controlled
--urlvalue. - The attacker supplies a URL targeting a local file, loopback service, private network service, or cloud metadata endpoint.
urllib.request.urlopen()retrieves the resource using the privileges and network access of the Skill process.- The response is stored in
textand passed into citation parsing and report generation. - Depending on response structure and selected output format, extracted content or identifiers can be exposed through the report, console, or subsequent external API requests.
Impact Assessment
Successful exploitation can provide indirect read access to resources reachable by the process, including local files supported by URL handlers, internal HTTP services, and ins ...[truncated 303 chars]
- An attacker causes the Skill or its invoking Agent to process an attacker-controlled
- Remediation
View remediation
Remediation Suggestions
- Permit only
httpsURLs and reject all other schemes, includingfile,ftp, anddata. - Reject embedded credentials, non-approved ports, malformed hostnames, and ambiguous IP representations.
- Resolve the hostname before connecting and block loopback, private, link-local, multicast, reserved, and unspecified address ranges for both IPv4 and IPv6.
- Disable automatic redirects or validate the scheme, hostname, port, and resolved address after every redirect.
- Consider using an explicit allowlist of trusted publication or bibliography hosts.
- Apply strict response-size and download-time limits and validate the expected content type.
- Run network retrieval in a sandbox with no access to local files, metadata services, or internal networks.
- Permit only
