Back to skill

Security audit

8bit 像素复古街机导演|AI-HIVE原创工作流

Security checks for vulnerabilities and agentic risk

Overview

This AI-HIVE workflow is mostly coherent, but it includes an unsafe credential-bearing endpoint override and broad implicit activation around paid external generation tools.

Review this skill before installing. Use OAuth or API keys only with the official AI-HIVE endpoint, do not set AI_HIVE_MCP_URL unless you fully trust the destination, and confirm model, price, budget, upload, generation, batch, send, and publish actions explicitly.

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:17
Finding
Authentication Credentials Can Be Exfiltrated Through an Unrestricted MCP Endpoint Override<![CDATA[ ## Vulnerability Details **File Location**: `scripts/ai_hive_mcp.py`, lines 17–75 **Vulnerability Type**: Unvalidated credential destination / sensitive information disclosure **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 fetch_json(url: str) -> dict: request = urllib.request.Request(url, headers={"accept": "application/json"}) with urllib.request.urlopen(request, timeout=20) as response: return json.loads(response.read().decode("utf-8")) def parse_payload(raw: bytes, content_type: str) -> dict: text = raw.decode("utf-8", errors="replace").strip() if "text/event-stream" in content_type or text.startswith("event:") or text.startswith("data:"): for line in text.splitlines(): if line.startswith("data:"): candidate = line[5:].strip() if candidate and candidate != "[DONE]": return json.loads(candidate) raise RuntimeError("MCP returned SSE without a parseable data event.") if not text: return {} return json.loads(text) 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 authenticate through their MCP client; " "this script requires AI_HIVE_API_KEY for tool calls, or doctor can be run without credentials." ) def post(payload: dict, session_id: str | None = None) -> tuple[dict, str | None]: he ...[truncated 2799 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. **Remove the endpoint override when it is not required.** Use a fixed endpoint: ```python MCP_URL = "https://ai-hive.iclip.cn/api/mcp" ``` 2. **If endpoint configurability is required, enforce an exact allowlist before obtaining or attaching credentials:** ```python from urllib.parse import urlsplit EXPECTED_SCHEME = "https" EXPECTED_HOST = "ai-hive.iclip.cn" EXPECTED_PORT = 443 EXPECTED_PATH = "/api/mcp" def validate_mcp_url(raw_url: str) -> str: parsed = urlsplit(raw_url) if parsed.scheme != EXPECTED_SCHEME: raise SystemExit("The MCP endpoint must use HTTPS.") if parsed.hostname != EXPECTED_HOST: raise SystemExit("The MCP endpoint host is not authorized.") if parsed.port not in (None, EXPECTED_PORT): raise SystemExit("The MCP endpoint port is not authorized.") if parsed.path != EXPECTED_PATH or parsed.query or parsed.fragment: raise SystemExit("The MCP endpoint path is not authorized.") if parsed.username or parsed.password: raise SystemExit("User information is not permitted in the MCP URL.") return raw_url ``` 3. **Validate the destination before calling `auth_headers()`.** Sensitive headers should only be constructed after the endpoint has passed validation. 4. **Disable cross-origin redirects for authenticated requests.** Reject redirects or explicitly verify every redirect target before resending a request. Never forward `Authorization` or `x-ai-hive-api-key` headers to a different origin. 5. **Separate public metadata requests from authenticated requests.** Keep OAuth metadata retrieval credential-free and use a dedicated authenticated transport for the fixed MCP endpoint. 6. **Fail closed.** If URL parsing or validation is ambiguous, terminate without sending the request. 7. **Add automated security tests** confirming rejection of: - HTTP endpoints. - Alternate domains and subdomains. - Nonstandard ports. - User-information UR ...[truncated 315 chars]
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
91% 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 the environment or execution context, they can redirect requests to an attacker-controlled server and exfiltrate the API key or bearer token through request headers.

Lp3

Medium
Category
MCP Least Privilege
Confidence
87% confidence
Finding
The skill advertises executable workflows and includes code snippets that use environment variables, local file read/write, and remote network access, but it does not declare any permissions or capability boundaries. This can cause the host agent to invoke the skill with broader implicit trust than warranted, increasing the risk of unintended secret exposure, local file access, or outbound requests to external infrastructure.

Vague Triggers

Medium
Confidence
80% confidence
Finding
The description contains broad trigger phrases such as AI images, AI video, anime/game, and short-video production, which overlap with many ordinary content-creation requests beyond the stated specialized use case. Over-broad invocation criteria can cause the skill to activate in unrelated contexts and steer users into an external workflow with networked actions and possible paid operations.

Vague Triggers

Medium
Confidence
84% confidence
Finding
The search tags include many generic terms like video editing, graphic design, text input, image generation, video generation, short video, and AIGC without meaningful scope limits. This makes invocation boundaries unclear and increases the chance the skill will be selected for broad creative tasks where users did not intend to use this specific external service or its operational flow.

Vague Triggers

Medium
Confidence
94% confidence
Finding
The skill enables implicit invocation for a workflow that can reach an external MCP service capable of image/video generation and potentially paid or publishing-related actions. Even though the prompt text says not to auto-pay, batch, or publish, implicit invocation increases the chance the skill is triggered without sufficiently explicit user intent, causing unintended data sharing to the third-party endpoint or nudging users into downstream actions they did not clearly request.

Static analysis

No suspicious patterns detected.