T09 · Insecure Skill Coding Practices
- Location
scripts/__main__.py:21- Finding
Unvalidated API Host Override Exposes Credentials and User Data to Arbitrary Servers
- Content
View full analysis
dict: """Perform web search""" if not MINIMAX_API_KEY: return {"success": False, "error": "MINIMAX_API_KEY not set. Please set MINIMAX_API_KEY environment variable."} url = f"{MINIMAX_API_HOST}/v1/coding_plan/search" headers = { "Authorization": f"Bearer {MINIMAX_API_KEY}", "Content-Type": "application/json" } payload = {"q": query} try: response = requests.post(url, headers=headers, json=payload, timeout=30) ``` The same pattern is used by the image-analysis, chat, and streaming-chat functions: ```python url = f"{MINIMAX_API_HOST}/v1/coding_plan/vlm" headers = { "Authorization": f"Bearer {MINIMAX_API_KEY}", "Content-Type": "application/json" } response = requests.post(url, headers=headers, json=payload, timeout=60) ``` ```python url = f"{MINIMAX_API_HOST}/v1/messages" headers = { "Authorization": f"Bearer {MINIMAX_API_KEY}", "Content-Type": "application/json", "anthropic-version": "2023-06-01" } response = requests.post(url, headers=headers, json=payload, timeout=120) ``` ### Technical Analysis The optional `MINIMAX_API_HOST` environment variable completely controls the origin receiving requests, but the value is not parsed or validated before use. In particular, the implementation does not: - Require HTTPS. - Verify that the hostname belongs to MiniMax. - Reject embedded credentials, unexpected ports, or malformed URLs. - Require explicit approval before transmitting the bearer token to ...[truncated 2034 chars]- Remediation
View remediation
