T09 · Insecure Skill Coding Practices
- Location
scripts/minimax_plan.py:84- Finding
Arbitrary Image URL Fetching Enables Server-Side Request Forgery
- Content
View full analysis
Vulnerability Details
File Location:
scripts/minimax_plan.py, lines 84–89
Vulnerability Type: Server-Side Request Forgery (SSRF) and unbounded response handling
Risk Level: Highpython if image_source.startswith(("http://", "https://")): req = urllib.request.Request(image_source, headers={"User-Agent": "OpenClaw-MiniMax-Plan/1.0"}) with urllib.request.urlopen(req, timeout=30) as resp: data = resp.read() mime = detect_mime(image_source, resp.headers.get("Content-Type", "")) encoded = base64.b64encode(data).decode("utf-8") return "data:%s;base64,%s" % (mime, encoded)Technical Analysis
The
--image-sourceargument is treated as a URL and fetched from the Agent's network context without validating its hostname or resolved IP address. The implementation does not reject loopback, link-local, private, reserved, or cloud metadata destinations. Redirects are followed by the underlying URL handler without revalidating the final destination.The response is read without a byte limit and is not verified as a valid JPEG, PNG, or WebP image. Unsupported or non-image content falls back to
image/jpeg, allowing arbitrary HTTP response bodies to be Base64-encoded and submitted to the MiniMax image-analysis endpoint.Base64 encoding itself is necessary for the declared image-understanding feature and is not covert behavior. The vulnerability arises because arbitrary remote content can be fetched and subsequently transmitted without destination, content, or size controls.
Attack Path
- An attacker causes the Skill to run
understand_imagewith an attacker-selected URL. - The URL points directly to an internal service, loopback endpoint, private-network host, or a public endpoint that redirects to one.
- The wrapper sends an HTTP request from the Agent's trusted network environment.
- The complete response is read into memory without a size limit.
- The respo ...[truncated 977 chars]
- An attacker causes the Skill to run
- Remediation
View remediation
Remediation Suggestions
- Prefer accepting local image files and preapproved HTTPS image hosts rather than arbitrary URLs.
- Require HTTPS and enforce an explicit hostname allowlist where remote retrieval is necessary.
- Resolve the hostname before connecting and reject loopback, link-local, private, multicast, reserved, and unspecified IP ranges for both IPv4 and IPv6.
- Disable redirects or validate every redirect destination using the same hostname and resolved-address checks.
- Protect against DNS rebinding by ensuring that the validated address is the address used for the connection.
- Enforce a conservative maximum response size using
Content-Lengthwhere available and bounded incremental reads in all cases. - Reject unexpected content types and decode the response with a trusted image library to verify its actual format before forwarding it.
- Restrict supported formats to the documented JPEG, PNG, and WebP types instead of defaulting arbitrary content to JPEG.
- Run URL retrieval in a network sandbox that cannot reach internal services or cloud metadata endpoints.
- Return a clear validation error when a source violates these controls.
