T09 · Insecure Skill Coding Practices
- Location
scripts/ai_hive_mcp.py:17- Finding
API credentials can be redirected through an unrestricted MCP endpoint override
- Content
View full analysis
tuple[dict, str | None]: headers = { "content-type": "application/json", "accept": "application/json, text/event-stream", **auth_headers(), } if session_id: headers["mcp-session-id"] = session_id request = urllib.request.Request( MCP_URL, data=json.dumps(payload, ensure_ascii=False).encode("utf-8"), headers=headers, method="POST", ) try: with urllib.request.urlopen(request, timeout=60) as response: ``` ### Technical Analysis The script obtains `AI_HIVE_API_KEY` or `AI_HIVE_ACCESS_TOKEN` from the environment through `auth_headers()` and attaches the resulting authentication header to requests sent to `MCP_URL`. The destination is independently configurable through the `AI_HIVE_MCP_URL` environment variable. The script does not verify that the configured URL: - Uses HTTPS. - Resolves to the declared `ai-hive.iclip.cn` host. - Uses an expected port. - Does not contain embedded credentials. - Belongs to an explicitly trusted development environment. Consequently, a poisoned process environment can redirect an authenticated MCP request to an unrelated server. Sending authentication information to the legitimate AI-HIVE endpoint is necessary for the declared functionality; allowing that information to be sent to an arbitrary endpoint is not required and violates least-privilege principles. This issue does not demonstrate intentional exfiltration. Exploitation requires control over, or influence on, the environment used to launch the script. ### Attack Pa ...[truncated 1235 chars]- Remediation
View remediation
