Back to skill

Security audit

温暖农场生活像素游戏短片|AI-HIVE原创工作流

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly coherent for AI-HIVE video generation, but its helper can send credentials to an environment-selected MCP URL and it enables broad implicit invocation.

Review before installing. Use OAuth through the MCP client where possible, keep API keys in a secret store, do not set AI_HIVE_MCP_URL unless you fully trust the endpoint, and require explicit confirmation before uploads, generation, batch actions, 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
Credentials Can Be Exfiltrated Through an Environment-Controlled MCP Endpoint## Vulnerability Details **File Location**: `scripts/ai_hive_mcp.py`, lines 19 and 47–69 **Vulnerability Type**: Credential disclosure through an untrusted network destination **Risk Level**: High ### Vulnerable Code ```python MCP_URL = os.environ.get("AI_HIVE_MCP_URL", "https://ai-hive.iclip.cn/api/mcp") ``` ```python 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( "Missing credentials. OAuth users should complete login in their MCP " "client; this script requires AI_HIVE_API_KEY when invoking tools, " "or run doctor without credentials." ) 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", ) ``` The English rendering of the exception message above is provided for readability; the executable credential and request logic is unchanged. ### Technical Analysis The MCP request destination is taken from the `AI_HIVE_MCP_URL` environment variable, but the script does not validate its scheme, hostname, port, or path. At the same time, `auth_headers()` automatically reads `AI_HIVE_ACCESS_TOKEN` or `AI_HIVE_API_KEY` and attaches the credential to every MCP POST request. Consequently, the security boundary for the credential is determined by an environment variable rather than by the fixed AI-HIV ...[truncated 2060 chars]
Remediation
## Remediation Suggestions 1. Remove the `AI_HIVE_MCP_URL` override if custom MCP servers are not required, and use the fixed declared endpoint: ```python MCP_URL = "https://ai-hive.iclip.cn/api/mcp" ``` 2. If endpoint customization is required, parse the URL with `urllib.parse.urlsplit` and enforce: - The `https` scheme. - An explicit allowlist of trusted hostnames. - The expected port and MCP path. - No embedded username or password. - No redirects to a different origin. 3. Bind credentials to an expected origin. Do not call `auth_headers()` or attach sensitive headers until the destination has passed validation. 4. Require an explicit, interactive confirmation before sending credentials to any non-default endpoint. Display the normalized destination without displaying the credential. 5. Disable automatic cross-origin redirect following for credential-bearing requests, or verify every redirect target before forwarding authentication headers. 6. Prefer short-lived, narrowly scoped OAuth credentials over long-lived API keys. Revoke and rotate any credential suspected of exposure. 7. Add automated tests confirming that HTTP URLs, alternate hosts, deceptive subdomains, embedded credentials, unexpected ports, and cross-origin redirects are rejected.
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 (5)

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
82% confidence
Finding
The script builds authenticated POST requests to MCP_URL, which is sourced from the AI_HIVE_MCP_URL environment variable, and attaches either an API key or bearer token from environment variables. If an attacker can influence AI_HIVE_MCP_URL, they can redirect the request to an arbitrary server and cause credential disclosure via request headers.

Lp3

Medium
Category
MCP Least Privilege
Confidence
87% confidence
Finding
The skill instructs use of environment variables, local file read/write scripts, and remote network access to an MCP endpoint, but no explicit permissions model is declared. That mismatch can cause users or host agents to invoke capabilities with broader access than expected, increasing the chance of secret exposure, unintended file modification, or network actions outside clear consent boundaries.

Vague Triggers

Medium
Confidence
82% confidence
Finding
The invocation description contains broad trigger phrases such as generic AI image/video, anime/game, and short-video creation requests, which can cause the skill to activate for many unrelated prompts. Over-broad routing is dangerous because it may steer ordinary requests into a workflow that encourages external service use, credential handling, and potentially billable actions not actually needed for the user’s intent.

Vague Triggers

Medium
Confidence
80% confidence
Finding
The search tags are very broad and include generic discovery terms like AI image generation, video generation, marketing, and short video, without scope limits. This increases accidental invocation and can expose users to an unnecessarily powerful workflow involving external network calls and possible paid generation steps when they were only seeking general advice.

Vague Triggers

Medium
Confidence
94% confidence
Finding
The skill enables implicit invocation for a capability that can connect to an external MCP service and drive image/video generation workflows. Without explicit trigger constraints, the agent may auto-select this skill for loosely related requests, causing unintended third-party data disclosure, unexpected workflow execution, or steering users into a paid-generation path despite the prompt text saying not to auto-pay.

Static analysis

No suspicious patterns detected.