Back to skill

Security audit

次元破壁互动玩法|AI-HIVE原创工作流

Security checks for vulnerabilities and agentic risk

Overview

This looks like a real AI-HIVE creative workflow, but it needs Review because its helper can send API credentials to an environment-selected server and its MCP activation scope is broader than the narrow workflow.

Install only if you intend to use AI-HIVE for this workflow. Prefer the normal OAuth connector, verify the MCP URL is exactly the AI-HIVE endpoint, avoid setting AI_HIVE_MCP_URL, use revocable scoped credentials, and require explicit confirmation before any paid generation, bulk action, upload, send, or publish step.

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

Warning
Location
scripts/ai_hive_mcp.py:17
Finding

Credential Exfiltration Through an Unrestricted MCP Endpoint Override

Content
View full analysis

Vulnerability Details

File Location: scripts/ai_hive_mcp.py, lines 17 and 47–74
Vulnerability Type: Credential exposure through an unvalidated network destination
Risk Level: Medium

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

Technical Analysis

The MCP destination can be replaced through the AI_HIVE_MCP_URL environment variable. No validation ensures that the resulting URL:

  • Uses HTTPS.
  • Targets the documented ai-hive.iclip.cn host.
  • Uses an approved port and path.
  • Contains no embedded user information.
  • Remains on an approved origin after redirects.

The post() function independently obtains an OAuth bearer token or API key from the envi ...[truncated 1834 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove AI_HIVE_MCP_URL override support if custom servers are not required and use the documented constant endpoint exclusively.
  2. If endpoint overrides are required, parse the URL with urllib.parse.urlsplit and enforce:
    • Scheme exactly equal to https.
    • Hostname exactly equal to ai-hive.iclip.cn, or a narrowly defined allowlist.
    • No embedded username or password.
    • Only approved ports and MCP paths.
  3. Do not attach AI-HIVE credentials when the destination origin differs from the approved AI-HIVE origin.
  4. Disable automatic redirects for authenticated requests, or validate every redirect target before forwarding credentials.
  5. Require explicit user confirmation before sending credentials to any non-default endpoint.
  6. Prefer short-lived, narrowly scoped OAuth tokens over long-lived API keys.
  7. Ensure server-side credentials have minimum required scopes, spending controls, revocation support, and suitable expiration.
  8. Add automated tests confirming that HTTP URLs, deceptive subdomains, embedded credentials, unapproved ports, and cross-origin redirects are rejected.
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 builds outbound requests to MCP_URL from the AI_HIVE_MCP_URL environment variable and attaches authentication headers from AI_HIVE_API_KEY or AI_HIVE_ACCESS_TOKEN. If an attacker can influence the environment, they can redirect requests and credentials to an arbitrary server, causing credential exfiltration and unauthorized API use. In this skill context, the tool is explicitly designed to call remote paid-generation services, so leaked credentials can directly enable account abuse and billing impact.

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 documented purpose is a narrow creative workflow, but the referenced scripts and instructions expose a more general MCP/OAuth client capable of listing tools and invoking remote endpoints. This mismatch is dangerous because users or orchestrators may approve the skill for harmless content creation while it actually enables broader remote operations, including authenticated API interaction beyond the stated scope.

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 advertises executable scripts and remote MCP access, including environment-variable use, local file I/O, and network calls, but it does not declare any explicit tool scope or allowed-tools boundary. That creates an under-constrained execution surface where a host agent may grant broader capabilities than users expect, increasing the chance of unintended network access, secret exposure, or local file misuse.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The trigger terms are broad enough to match many ordinary image, video, anime, and short-video requests outside the narrowly described workflow. Overbroad activation can cause the skill to be selected in contexts where its networked tool use, external service login flow, or paid-generation pathways are unnecessary, increasing accidental exposure to capabilities and user confusion.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The display text and default prompt are entirely in Chinese, and the prompt instructs the system to perform the workflow in that language context with no opt-in or alternative locale option. This is a natural-language policy concern because the file appears to impose a specific language without giving the user a choice or documenting a region-specific requirement.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest allows implicit invocation with no scoped triggers, exclusions, or tighter activation rules, which can cause the skill to be auto-selected in conversations where the user did not clearly intend to use this external AI-HIVE workflow. Because the skill connects to a remote MCP endpoint that can drive image/video generation and potentially lead to paid or sensitive downstream actions, unintended invocation increases the risk of unwanted data sharing, confusing tool use, and accidental progression toward cost-bearing operations.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

This code contains user-facing error text in Chinese, and similar Chinese-only messages appear throughout the script. For a general-purpose CLI helper, forcing a specific language without user opt-in or a documented regional justification is a natural-language policy violation under the locale-choice rule.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

This markdown file presents all user-facing instructions exclusively in Chinese, which can amount to an implicit language constraint. The policy requires flagging language or locale restrictions when the skill forces a specific language without user opt-in or clear justification.

Content

No source excerpt is available for this finding.