T09 · Insecure Skill Coding Practices
- Location
scripts/videogen.py:232- Finding
API-Controlled Arbitrary Media Upload Destination
- Content
View full analysis
Vulnerability Details
File Location:
scripts/videogen.py, lines 232-243
Vulnerability Type: Unvalidated externally supplied upload URL and HTTP method
Risk Level: MediumVulnerable Code
python upload_url = token["upload"]["url"] upload_method = token["upload"].get("method", "PUT") upload_headers = token["upload"].get("headers", {}) # PUT to object storage without the API key, using the returned headers print(f"[2/3] Uploading file to object storage...") with open(str(path), "rb") as f: try: oss_resp = requests.request( upload_method, upload_url, headers=upload_headers, data=f, timeout=300, )Technical Analysis
The upload-token API response controls the destination URL, HTTP method, and request headers used when transmitting a user-selected local media file. The client does not validate that
upload_urluses HTTPS, belongs to an approved object-storage domain, or resolves to a non-local address. It also does not restrictupload_methodto an expected method such asPUT.Consequently, a compromised AI Hive service, compromised API account, malicious upstream component, or intercepted response under a compromised trust environment could instruct the client to send the selected file to an attacker-controlled endpoint. Supplying an HTTP URL could also remove transport confidentiality.
The authorization header used for AI Hive is not attached to this request, which limits direct API-key disclosure. Nevertheless, the complete contents of the selected media file and any server-supplied upload headers are transmitted to the unvalidated destination.
Attack Path
- The user invokes the
generateoruploadcommand with a local media file. - The client sends the file metadata to the fixed upload-token API.
- A compromised or malicious upstream response returns an attacker-controlled
upload.url, arbitraryupload.method, and op ...[truncated 721 chars]
- The user invokes the
- Remediation
View remediation
Remediation Suggestions
- Require the upload URL to use
https. - Maintain an explicit allowlist of approved object-storage hostnames and reject all other destinations.
- Resolve and validate the destination address to reject loopback, link-local, private, and reserved network ranges where they are not explicitly required.
- Restrict the upload method to the exact methods supported by the service, normally
PUTorPOST. - Validate server-supplied headers against a small allowlist and reject sensitive or unexpected headers.
- Revalidate the destination after every redirect, or disable redirects for upload requests.
- Fail closed when any URL, hostname, method, or header validation fails.
- Consider binding the expected upload host and method into a signed upload-token response that can be verified locally.
- Require the upload URL to use
