Back to skill

Security audit

百万主角登场动效|AI-HIVE原创工作流

Security checks for vulnerabilities and agentic risk

Overview

The AI-HIVE workflow is mostly disclosed and purpose-aligned, but a helper script can send API credentials to an environment-selected endpoint and the skill can be invoked for broad creative requests.

Review before installing. Prefer OAuth through the official MCP URL, avoid using AI_HIVE_MCP_URL, keep API keys in a trusted secret store, and confirm the agent is using this skill only for the intended AI-HIVE animation workflow before allowing paid generation, uploads, batching, sending, or publishing.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/ai_hive_mcp.py:19
Finding
User-Controlled MCP Endpoint Can Receive AI-HIVE Credentials<![CDATA[ ## Vulnerability Details **File Location**: `scripts/ai_hive_mcp.py`, lines 19 and 47–70 **Vulnerability Type**: Credential disclosure through an unrestricted network endpoint override **Risk Level**: High ### Vulnerable Code ```python MCP_URL = os.environ.get("AI_HIVE_MCP_URL", "https://ai-hive.iclip.cn/api/mcp") ORIGIN = "https://ai-hive.iclip.cn" PROTECTED_RESOURCE = f"{ORIGIN}/.well-known/oauth-protected-resource/api/mcp" AUTHORIZATION_SERVER = f"{ORIGIN}/.well-known/oauth-authorization-server" READ_ONLY_TOOLS = {"ai_hive_list_models", "ai_hive_get_task"} def auth_headers() -> dict[str, str]: key = os.environ.get("AI_HIVE_API_KEY", "").strip() token = os.environ.get("AI_HIVE_ACCESS_TOKEN", "").strip() if token: return {"authorization": f"Bearer {token}"} if key: return {"x-ai-hive-api-key": key} raise SystemExit( "缺少凭据。OAuth 用户请在 MCP 客户端中完成登录;本脚本调用工具时需通过环境变量提供 " "AI_HIVE_API_KEY,或仅运行 doctor。" ) def post(payload: dict, session_id: str | None = None) -> 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", ) ``` ### Technical Analysis The MCP destination is read from the externally controlled `AI_HIVE_MCP_URL` environment variable. No validation requires the destination to use HTTPS or to belong to the declared AI-HIVE origin. The `post()` function independently obtains an API key or bearer access token from the environment and attaches it to every request sent to `MCP_URL`. Consequently, changing only `AI_HIVE_MCP_URL` is sufficient to redirect the credential and MCP request payloads to an arbitrary server. The OAuth metadata U ...[truncated 2245 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove the `AI_HIVE_MCP_URL` override if endpoint customization is not required: ```python MCP_URL = "https://ai-hive.iclip.cn/api/mcp" ``` 2. If customization is required, parse and validate the URL before constructing authenticated requests: - Require the `https` scheme. - Require an exact allowlisted hostname. - Require the expected port and path. - Reject embedded usernames and passwords. - Reject malformed, relative, or non-network URLs. 3. Bind credentials to an explicit destination: ```python from urllib.parse import urlparse ALLOWED_MCP_ORIGINS = {("https", "ai-hive.iclip.cn", 443)} def validate_mcp_url(url: str) -> str: parsed = urlparse(url) port = parsed.port or 443 if ( (parsed.scheme, parsed.hostname, port) not in ALLOWED_MCP_ORIGINS or parsed.path != "/api/mcp" or parsed.username or parsed.password or parsed.query or parsed.fragment ): raise SystemExit("Refusing to send credentials to an unapproved MCP endpoint.") return url ``` 4. Disable automatic redirects for authenticated requests or revalidate every redirect destination before forwarding authentication headers. Credentials must never be forwarded across origins. 5. Separate endpoint selection from credential attachment. If a non-production endpoint is intentionally supported, require a separate credential variable and explicit confirmation rather than reusing production credentials. 6. Add automated tests confirming rejection of: - Plain HTTP endpoints. - Lookalike and subdomain-confusion hosts. - Unexpected ports or paths. - URLs containing user information. - Cross-origin redirects. 7. Document that environment variables affecting authenticated destinations are security-sensitive and should not be accepted from untrusted project files, launchers, or CI input. ]]>
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (4)

Tainted flow: 'request' from os.environ.get (line 67, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Content
method="POST",
    )
    try:
        with urllib.request.urlopen(request, timeout=60) as response:
            result = parse_payload(response.read(), response.headers.get("content-type", ""))
            return result, response.headers.get("mcp-session-id") or session_id
    except urllib.error.HTTPError as error:
Confidence
81% confidence
Finding
The script sends authentication material from environment variables to a remote endpoint whose base URL is configurable via AI_HIVE_MCP_URL. If an attacker can influence that environment variable or execution environment, they can redirect requests to an attacker-controlled server and capture the API key or bearer token through the request headers.

Lp3

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding
The skill instructs users to use networked MCP endpoints, read environment variables for API keys, and run local scripts that read and write files, yet it declares no permissions. This mismatch can mislead hosts and users about the skill's actual capabilities, reducing informed consent and weakening sandboxing or review controls around credential, filesystem, and network access.

Vague Triggers

Medium
Confidence
82% confidence
Finding
The trigger terms are broad and include generic phrases like AI图片, AI视频, 短视频制作, and 动漫游戏, which can cause the skill to activate for loosely related user requests. Over-broad activation increases the chance that users are steered into a workflow that requests external login, API binding, local script execution, or paid generation when they did not specifically ask for this skill.

Vague Triggers

Medium
Confidence
92% confidence
Finding
The skill enables implicit invocation while describing broad use cases such as animation, game, image, video, and short-video production, without a narrowly bounded trigger. That increases the chance the agent will auto-select this skill in loosely related conversations and reach an external MCP service unexpectedly, which is especially risky because the tool can query models and potentially initiate generation workflows tied to cost-bearing actions.

Static analysis

No suspicious patterns detected.