T09 · Insecure Skill Coding Practices
- Location
scripts/media_gen_client.py:115- Finding
Unrestricted User-Controlled URL Fetch Enables Blind SSRF
- Content
View full analysis
Vulnerability Details
File Location:
scripts/media_gen_client.py, lines 115–117
Vulnerability Type: Server-Side Request Forgery (SSRF) and unbounded network response handling
Risk Level: MediumVulnerable Code
python if args.image.startswith("http"): image_content = urllib.request.urlopen(args.image, context=_get_ssl_context()).read() image_url = args.image if image_content else NoneTechnical Analysis
The
--imageargument is user-controlled. Any value beginning withhttpis fetched from the Agent host usingurllib.request.urlopen()without validating the destination.The implementation does not:
- Restrict URLs to HTTPS.
- Restrict requests to approved image-hosting domains.
- Reject loopback, private, link-local, reserved, or cloud metadata addresses.
- Resolve and validate the destination IP address.
- Revalidate redirect destinations.
- Set a request timeout.
- Limit the number of bytes read.
- Verify that the response is a supported image.
Consequently, an attacker can cause the Agent host to issue HTTP requests to services that may not be reachable from the attacker's own network. Redirect handling can also allow an apparently external URL to redirect to an internal destination.
The entire response is read into memory. A large or indefinitely delayed response may therefore consume excessive memory or block execution.
The fetched response body is only checked for non-emptiness and is not directly returned to the user or uploaded by this branch. This limits direct extraction of response contents, but it does not prevent blind internal-network probing, requests to sensitive endpoints, or denial of service.
Fetching a remote image is related to the declared video-generation functionality, but unrestricted access to arbitrary network destinations exceeds the minimum network privileges required.
Attack Path
- An attacker invokes the Skill with an image argument containing an attacker-selected HTTP U ...[truncated 1352 chars]
- Remediation
View remediation
Remediation Suggestions
- Accept only properly parsed
https://URLs rather than using a prefix check. - Where practical, allowlist trusted image-hosting domains.
- Resolve the hostname before connecting and reject all loopback, private, link-local, multicast, unspecified, reserved, and metadata-service addresses for both IPv4 and IPv6.
- Disable automatic redirects or validate every redirect destination using the same scheme, hostname, and resolved-address rules.
- Protect against DNS rebinding by ensuring the validated address is the address used for the connection.
- Set strict connection and read timeouts.
- Read the response incrementally and enforce a conservative maximum image size.
- Require an approved image MIME type and validate the file signature rather than trusting headers alone.
- Reject URLs containing credentials or unsupported ports, and normalize internationalized hostnames before validation.
- Prefer having the remote media service retrieve an allowlisted public image URL, or require local image upload through the existing temporary upload mechanism, to avoid granting the Agent host arbitrary outbound-request capability.
- Accept only properly parsed
