Back to skill

Security audit

火柴人破字闯关|AI-HIVE原创工作流

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a disclosed AI-HIVE animation workflow, but it includes under-scoped external MCP access and a helper script that can send API credentials to an environment-selected endpoint.

Review before installing. Prefer the fixed AI-HIVE OAuth connector, keep API keys out of prompts and logs, unset or avoid AI_HIVE_MCP_URL unless you fully trust the endpoint, and require explicit confirmation before any paid generation, upload, batch action, or publication.

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 Exfiltrate API Credentials

Content
View full analysis

Vulnerability Details

File Location: scripts/ai_hive_mcp.py, lines 19–74
Vulnerability Type: Credential disclosure through an unvalidated 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; "
        "tool calls from this script require AI_HIVE_API_KEY, or run doctor only."
    )


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

The English text in the first snippet above is a translation of the original user-facing error message; the executable credential and request logic is reproduced without semantic alteration.

Technical Analysis

The script accepts the authenticated MCP destination from the AI_HIVE_MCP_URL environment variable. Before attaching credentials, it does not validate:

  • That the URL uses HTTPS.
  • That the hostname ...[truncated 2614 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove the endpoint override if it is not required. Use a fixed MCP endpoint:
python
MCP_URL = "https://ai-hive.iclip.cn/api/mcp"
  1. If customization is required, validate the destination before attaching credentials. Require all of the following:

    • Scheme is exactly https.
    • Hostname is exactly ai-hive.iclip.cn.
    • Port is absent or equals 443.
    • Path is exactly /api/mcp.
    • URL contains no embedded username or password.
    • Redirects cannot leave the approved origin.
  2. Do not forward AI-HIVE credentials to development or custom endpoints. Use separate test credentials and an explicit development mode if non-production servers must be supported.

  3. Disable or strictly validate redirects. A trusted initial URL must not be allowed to redirect an authenticated request to another origin.

  4. Fail closed. Reject malformed URLs, plaintext HTTP, alternate ports, deceptive subdomains such as ai-hive.iclip.cn.attacker.example, and any destination outside the allowlist before calling auth_headers().

  5. Add automated security tests covering:

    • HTTP destinations.
    • Unapproved hosts and subdomains.
    • Embedded user information.
    • Alternate ports.
    • Unicode or encoded hostname confusion.
    • Cross-origin redirects.
    • Missing or unexpected paths.
  6. Rotate exposed credentials if the script has previously been run with an untrusted AI_HIVE_MCP_URL.

Vulnerability Patterns
  • 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
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (11)

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 credentials from environment variables to a remote endpoint whose base URL can be overridden 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 via the Authorization or x-ai-hive-api-key headers.

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
98% confidence
Finding

The skill is presented as a narrowly scoped原创动画工作流, but the referenced behavior includes a generic MCP/OAuth connector and arbitrary tool caller. That mismatch is dangerous because users and reviewers may trust it as a constrained creative workflow while it actually enables broader remote operations, including invoking tools outside the stated use case and bypassing expected confirmation boundaries.

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
90% confidence
Finding

The skill exposes or documents capabilities that imply environment access, file read/write, and network use, but it does not declare an explicit tool scope or permission boundary. In a skill that can connect to a remote MCP endpoint and invoke tools, missing scope constraints increases the risk of unintended tool access, overbroad execution, and weaker reviewability of what the skill is actually allowed to do.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The trigger description uses broad search phrases like AI图片、AI视频、短视频制作 and related terms that extend well beyond the named stick-figure workflow. Overly broad triggers can cause unintended invocation in unrelated contexts, routing users into a skill that can reach remote services and potentially initiate actions they did not specifically request.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The search coverage section lists a large set of generic discovery keywords without scope limits, which increases the chance of accidental activation. In this skill, accidental invocation is more concerning because the documented workflow includes remote MCP connectivity and tool usage, so a loose search surface can expose users to unintended external operations or confusing workflow takeover.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
83% confidence
Finding

The display name, short description, default prompt, and tool description are presented in Chinese only, with no indication that users may choose another language. This can amount to a language-policy issue if the organization expects skills not to force a specific language without user opt-in.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest enables implicit invocation without narrowly defined trigger constraints, allowing the platform to auto-select this skill based on broad user intent. Because this skill connects to an external MCP service capable of image/video generation and the description mentions downstream paid generation and publishing workflows, unintended invocation could expose user prompts to a third party or initiate sensitive creative actions without sufficiently explicit user consent.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This Python file contains multiple natural-language strings shown to users in Chinese, including errors, status messages, and CLI descriptions. Because the skill does not offer any language/locale selection or explain that it is intentionally region-specific, it violates the language/locale policy for natural-language content.

Content

No source excerpt is available for this finding.