T09 · Insecure Skill Coding Practices
- Location
scripts/generate_video.py:83- Finding
Unvalidated Server-Provided Video Download URL Enables SSRF and Resource Exhaustion
- Content
View full analysis
Vulnerability Details
File Location:
scripts/generate_video.py, lines 83–89
Vulnerability Type: Unvalidated remote URL fetch / server-side request forgery
Risk Level: Mediumpython download_url = file_data.get("file", {}).get("download_url") or file_data.get("data", {}).get("download_url") if not download_url: raise SystemExit(f"No download url returned: {json.dumps(file_data, ensure_ascii=False)}") video_response = requests.get(download_url, timeout=300) video_response.raise_for_status()Technical Analysis
The script obtains
download_urlfrom the MiniMax API response and passes it directly torequests.get. It does not validate the URL scheme, hostname, resolved IP address, redirect destinations, response content type, or response size. Becauserequestsfollows redirects by default, validating only an initial URL without also validating each redirect would remain insufficient.A malicious or compromised upstream service could return a URL targeting loopback, private, link-local, reserved, or otherwise unintended network resources. The subsequent response is also buffered in memory through
video_response.contentelsewhere in the same download workflow, without a maximum download-size restriction.The MiniMax API key is not forwarded to the server identified by
download_url, which limits direct credential exposure. Nevertheless, the request originates from the environment running the Skill and can therefore access network locations unavailable to an external attacker.Attack Path
- A user initiates video generation through the Skill.
- The MiniMax API account, API service, or relevant response path is compromised or made to return an attacker-controlled
download_url. - The script accepts that URL without validation.
requests.getsends an HTTP request from the Agent environment and follows redirects by default.- The attacker directs the request to an internal ...[truncated 1046 chars]
- Remediation
View remediation
Remediation Suggestions
- Allow only
httpsdownload URLs. - Enforce an allowlist of documented MiniMax-controlled CDN hostnames rather than accepting arbitrary hosts.
- Resolve the hostname before connecting and reject loopback, private, link-local, multicast, unspecified, and reserved IP address ranges for both IPv4 and IPv6.
- Disable automatic redirects or validate the scheme, hostname, and resolved address of every redirect destination before following it.
- Stream the response using
stream=Trueinstead of buffering the entire body. - Enforce a strict maximum number of downloaded bytes and abort when the limit is exceeded.
- Verify that the response has an expected video media type before writing it.
- Write to a temporary file and atomically rename it only after validation and successful completion.
- Apply egress filtering at the runtime or container level to prevent access to internal and metadata networks as defense in depth.
- Allow only
