Back to skill

Security audit

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

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches an AI-HIVE animation workflow, but its helper can send API credentials to an environment-selected MCP URL and the MCP/tool activation scope is broad enough to require review before install.

Review this skill before installing. Use OAuth or API keys only with the official AI-HIVE endpoint, avoid setting AI_HIVE_MCP_URL unless you fully trust the destination, revoke any key exposed to the wrong host, and require explicit confirmation before any paid generation, upload, batch, send, or publishing action.

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

Environment-Controlled MCP Endpoint Can Expose AI-HIVE Credentials

Content
View full analysis

Vulnerability Details

File Location: scripts/ai_hive_mcp.py, lines 19 and 47–75
Vulnerability Type: Credential disclosure through an unvalidated, environment-controlled 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(
        "缺少凭据。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 AI_HIVE_MCP_URL environment variable, but the script does not validate its scheme, hostname, port, or path before attaching an AI-HIVE API key or OAuth bearer token.

Consequently, any authenticated list-tools or call operation sends the credential to whichever destination is configured in that variable. The documented functionality consistently uses https://ai-hive.iclip.cn/api/mcp, so allowing arbitrary authenticated destinations exceeds the minimum privilege and configurability required by the declared workflow.

Python's urllib redirect behavior may also allow an authenticated request to be redirected. ...[truncated 1780 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove AI_HIVE_MCP_URL configurability if alternate endpoints are not a documented requirement:

    python
    MCP_URL = "https://ai-hive.iclip.cn/api/mcp"
    
  2. If endpoint configuration is required, validate it before constructing authenticated requests:

    • Require the https scheme.
    • Require the exact expected hostname.
    • Reject embedded user information.
    • Permit only the expected port.
    • Require the expected MCP path.
    • Reject fragments and unexpected query parameters.
  3. Bind credentials to an explicit origin allowlist. Do not attach AI-HIVE credentials to any URL other than the approved AI-HIVE origin.

  4. Disable automatic redirects for authenticated requests, or validate every redirect target and reject any origin change.

  5. Fail closed with a clear error when validation fails. Do not retry against a fallback or user-supplied destination while retaining authentication headers.

  6. Prefer OAuth tokens with narrowly scoped permissions and short lifetimes. Ensure API keys can be scoped to only the tools required by this Skill.

  7. Add regression tests confirming that:

    • HTTP endpoints are rejected.
    • Alternate hosts, ports, and paths are rejected.
    • Cross-origin redirects are rejected.
    • No credential header is emitted before destination validation succeeds.
  8. If exposure is suspected, immediately revoke the affected API key or OAuth authorization and remove the hostile environment configuration.

Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • 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
Findings (13)

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

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/ai_hive_mcp.py (reported line 28)May include surrounding context.

python
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"))

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

Critical
Category
Data Flow
Confidence
90% confidence
Finding

The script sends authenticated requests to MCP_URL, which is taken from the AI_HIVE_MCP_URL environment variable. If that variable is altered to point to an attacker-controlled server, the tool may transmit the API key header or bearer token to that host, causing credential exfiltration and potentially unauthorized API use.

Content

Scanner excerpt · scripts/ai_hive_mcp.py (reported line 74)May include surrounding context.

python
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:

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The skill is presented as a narrowly constrained workflow for original animation planning, but the referenced code behavior reportedly exposes generic MCP diagnostics, tool enumeration, and arbitrary tool invocation. This mismatch is dangerous because users and agents may trust the declared safety boundaries while the actual implementation can perform broader actions, including invoking non-read-only remote tools without any technical enforcement of originality, IP, or spend controls.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/mcp-binding.md (reported line 63)May include surrounding context.

md
## Codex、Claude 与 ChatGPT

优先使用各客户端的远程 MCP/连接器界面;若支持 JSON 配置,使用 OAuth 最小配置。客户端必须支持 Streamable HTTP、OAuth 2.1、PKCE 和动态客户端注册。若出现 `unauthorized_client`,保留脱敏错误和客户端版本,通过 AI-HIVE 登录后的客服渠道反馈,不要把 access token 粘贴到聊天中。

## Gemini 与支持 Header 的客户端

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/mcp-binding.md (reported line 102)May include surrounding context.

md
## Codex、Claude 与 ChatGPT

优先使用各客户端的远程 MCP/连接器界面;若支持 JSON 配置,使用 OAuth 最小配置。客户端必须支持 Streamable HTTP、OAuth 2.1、PKCE 和动态客户端注册。若出现 `unauthorized_client`,保留脱敏错误和客户端版本,通过 AI-HIVE 登录后的客服渠道反馈,不要把 access token 粘贴到聊天中。

## Gemini 与支持 Header 的客户端

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill documents executable scripts, environment-variable use, local file writes, and network access to a remote MCP endpoint, but it does not declare any explicit tool scope or allowed-tools boundary. That creates an authorization gap: an agent may infer broader execution privileges than intended, increasing the chance of unintended network calls, secret handling, or local side effects.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The description says the skill should be used when users search terms like “动漫游戏”, “AI图片”, “AI视频”, and “短视频制作”, which are broad topical phrases rather than specific activation triggers. These generic terms could collide with many unrelated requests and make it unclear when this skill should activate versus other animation, image, or video skills.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The display name, description, and default prompt are all written in Chinese, and the prompt instructs the skill in Chinese without indicating that other languages are supported. This can violate language/locale policy when no user opt-in or explicit region-specific justification is provided.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill enables implicit invocation without defining narrow activation criteria, so the agent may auto-select this skill for loosely related requests. Because the skill is connected to an external MCP endpoint that can generate content and potentially lead users toward paid or publishing workflows, overly broad activation increases the chance of unintended tool use, privacy exposure, or user confusion about consent boundaries.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

This file presents all operational instructions in Chinese and does not indicate that users may choose another language or locale. That can violate a language/locale policy when the skill is used in broader contexts without explicit user opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
97% confidence
Finding

This code includes user-facing error text in Chinese, and the CLI description/help strings elsewhere in the file are also Chinese-only. That can violate a language/locale policy when no user opt-in or language selection is offered.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
97% confidence
Finding

The script emits Chinese-only credential guidance to users, including operational instructions. Because the file provides no language selection or documented region-specific limitation, this is a natural-language locale policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

Argument parser descriptions and confirmation guidance are all Chinese-only, which forces a specific language for interaction. The file does not offer alternate locales or state that the tool is region-specific and intentionally Chinese-only.

Content

No source excerpt is available for this finding.