Back to skill

Security audit

主题变身特效短片|AI-HIVE原创工作流

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a disclosed AI-HIVE advertising workflow, but its helper script can send API credentials to an arbitrary endpoint if an environment override is set.

Install only if you intend to use AI-HIVE for this advertising workflow. Do not set AI_HIVE_MCP_URL unless you fully trust the endpoint, prefer OAuth or a scoped API key, revoke any key used with an untrusted endpoint, and require explicit confirmation before paid generation, uploads, batch actions, sending, or public 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:17
Finding

Unrestricted MCP Endpoint Override Can Expose API Credentials

Content
View full analysis

Vulnerability Details

File Location: scripts/ai_hive_mcp.py, lines 17–72
Vulnerability Type: Credential disclosure through an unrestricted network endpoint
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",
    )
    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 authenticated MCP destination is read directly from the AI_HIVE_MCP_URL environment variable. The value is not validated against an allowed hostname, scheme, port, or origin before auth_headers() attaches either an AI-HIVE API key or OAuth bearer token.

Consequently, the script can send credentials to any URL selected through the process environment, including an attacker-controlled HTTPS endpoint or a plaintext HTTP endp ...[truncated 1985 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove AI_HIVE_MCP_URL configurability if alternate endpoints are not required, and use the fixed documented URL:

    python
    MCP_URL = "https://ai-hive.iclip.cn/api/mcp"
    
  2. If endpoint overrides are operationally necessary, validate the URL before adding authentication headers:

    • Require the https scheme.
    • Allowlist the exact hostname ai-hive.iclip.cn.
    • Require the expected /api/mcp path.
    • Reject embedded usernames or passwords.
    • Reject unexpected ports, fragments, and ambiguous host representations.
  3. Do not attach production credentials to non-production or untrusted endpoints. Require separate test credentials for explicitly approved development servers.

  4. Disable or tightly control cross-origin redirects for authenticated requests. Verify that the final response origin remains the approved AI-HIVE origin and never resend sensitive headers to another origin.

  5. If custom endpoints must be supported, require an explicit command-line opt-in and display the normalized destination before using credentials. Interactive confirmation should supplement, not replace, hostname and TLS validation.

  6. Add automated tests proving that HTTP URLs, lookalike domains, embedded credentials, unexpected ports, and non-allowlisted hosts are rejected before auth_headers() is called.

  7. Advise affected users to revoke and replace credentials if they have executed the client with an untrusted AI_HIVE_MCP_URL value.

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 (10)

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

The script allows AI_HIVE_MCP_URL from the environment to override the default server, then sends authentication headers from AI_HIVE_API_KEY or AI_HIVE_ACCESS_TOKEN to that URL. If an attacker can influence the environment or execution context, they can redirect requests to an attacker-controlled endpoint and exfiltrate credentials or cause paid tool invocations against an unintended service.

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

The documented purpose is a narrow advertising workflow with confirmation gates, but the referenced behavior includes a generic MCP client capable of initializing sessions, inspecting OAuth metadata, and calling arbitrary tools. That mismatch is dangerous because users and orchestrators may trust the skill as constrained while it actually provides a lower-level primitive that can reach capabilities outside the advertised flow.

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 exposes instructions and code paths for network access, environment-variable use, and local file read/write, but declares no explicit tool scope or permission boundary. In an agent environment, that gap can let the skill invoke broader capabilities than a user would reasonably infer, increasing the risk of unintended external calls, secret access, or filesystem side effects.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The invocation/search terms are broad enough to match common requests like AI images, videos, short-video production, and advertising, far beyond a tightly scoped transformation-effects workflow. Overbroad routing can cause the skill to activate in contexts the user did not intend, increasing chances of unnecessary network/tool use, paid actions, or handling sensitive commercial assets under the wrong workflow.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest sets language: zh-CN, and the entire skill is presented as Chinese-only without offering opt-in or alternative language behavior. Under the policy, forcing a specific language or locale without user choice or a clearly justified region-specific constraint is a natural-language policy violation.

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 for a capability that can trigger external MCP access to an advertising-generation service without narrowly defined trigger conditions. In context, this increases the chance the agent will invoke the skill on loosely related user requests, causing unintended data sharing with a third-party service or workflow initiation beyond what the user expected.

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 user-facing error/help strings in Chinese, starting at L040, and the CLI description/help text also continues in Chinese elsewhere. The policy for all file types says to flag language/locale constraints when a skill forces a specific language without user opt-in, and this file provides no language selection or justification for a Chinese-only interface.

Content

No source excerpt is available for this finding.