T09 · Insecure Skill Coding Practices
- Location
scripts/media_gen_client.py:119- Finding
Unrestricted User-Controlled URL Fetch Enables Blind SSRF
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill is a real remote image-to-video client, but it can fetch arbitrary URLs and upload any readable local file when given as an image path.
Install only if you are comfortable sending selected images to the MagicLight remote service. Do not provide sensitive local paths, private documents, credential files, internal URLs, localhost URLs, or cloud metadata URLs as the image input; prefer a known image file in a dedicated folder or a trusted public HTTPS image URL. Use MAGIC_API_KEY from a protected environment variable rather than the --api-key command-line option.
scripts/media_gen_client.py:119Unrestricted User-Controlled URL Fetch Enables Blind SSRF
scripts/media_gen_client.py:122Arbitrary Local File Read and Upload Through the Image Path Argument
scripts/media_gen_client.py:178API Key Accepted Through a Command-Line Argument
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
req = urllib.request.Request(url, data=data, headers=all_headers, method=method.upper())
try:
with urllib.request.urlopen(req, timeout=timeout_s, context=_get_ssl_context()) as resp:
raw = resp.read().decode("utf-8")
return json.loads(raw) if raw else {}
except urllib.error.HTTPError as e:
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
put_url = image_put_url_resp.get("data", {}).get("put_url")
# put_url是临时上传地址,需要上传图片到put_url
req = urllib.request.Request(put_url, data=image_content, method="PUT")
with urllib.request.urlopen(req, context=_get_ssl_context()) as resp:
status = resp.getcode()
if status != 200:
raise Exception(f"Failed to upload image to put_url, status: {status}")
The skill invokes a Python client that requires environment access to read MAGIC_API_KEY and performs network requests to a remote video service, but the manifest does not declare any explicit tool scope such as permissions or allowed-tools. This weakens least-privilege enforcement and reduces review visibility into what the skill is allowed to access, making unintended credential exposure or unauthorized external communication harder to control.
The script directly fetches arbitrary user-supplied URLs before submitting the task, which gives the skill a general-purpose outbound URL retrieval capability. In an agent setting, this can be abused for SSRF-style access to internal services, cloud metadata endpoints, or other network locations reachable from the runtime environment.
When given a local file path, the script reads the file and uploads its contents to a remote temporary storage endpoint. That creates remote file-transfer behavior that can expose sensitive local files if an attacker can influence the path or trick a user/agent into supplying one, especially since the manifest frames the skill as media generation rather than generic file upload.
The code silently transmits local image data to a remote endpoint without a clear user-facing warning at the moment of upload. In an agent context, that lack of disclosure increases the chance of accidental data exfiltration because users may believe they are only referencing a local file for processing rather than sending it off-host.
No suspicious patterns detected.