T09 · Insecure Skill Coding Practices
- Location
scripts/discover.py:97- Finding
Unrestricted Metadata URL Fetching Enables Server-Side Request Forgery
- Content
View full analysis
80 else ''}") metadata = decode_metadata_uri(metadata_uri) ``` ### Technical Analysis The `metadata_uri` value originates from agent data returned by the Agentscan API. An agent registrant who controls that field can supply an arbitrary HTTP or HTTPS URL. The code passes the URL to `api_request()`, which ultimately invokes `urllib.request.urlopen()`. There is no validation of: - The destination hostname or resolved IP address - Loopback, private, link-local, reserved, or unspecified address ranges - Cloud instance metadata addresses such as `169.254.169.254` - Redirect destinations - Plain HTTP usage - Response size or expected content type As a result, selecting a malicious agent with the `info` command can make the client issue requests to services reachable from the victim's environment. Automatic redirect handling may also allow an initially public URL to redirect to a prohibited internal destination. Fetching remote metadata is related to the declared information-display functionality, but unrestricted access to arbitrary network destinations exceeds the minimum privileges required. Metadata retrieval could instead be restricted ...[truncated 1400 chars]- Remediation
View remediation
