Back to skill

Security audit

汽车/赛车宣传短片|AI-HIVE原创工作流

Security checks for vulnerabilities and agentic risk

Overview

This looks like a real AI-HIVE advertising workflow, but its helper script can send API credentials to an environment-selected MCP endpoint.

Install only if you trust the AI-HIVE MCP service and are comfortable with a broad remote tool integration. Prefer OAuth through the client UI, avoid setting AI_HIVE_MCP_URL, keep API keys in a secret store, and confirm model, price, budget, and task details before any paid generation 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

Warning
Location
scripts/ai_hive_mcp.py:19
Finding

Credential Disclosure Through an Unrestricted MCP Endpoint Override

Content
View full analysis

Vulnerability Details

File Location: scripts/ai_hive_mcp.py, lines 19 and 47–72
Vulnerability Type: Credential forwarding to an environment-controlled 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",
    )

Technical Analysis

The script obtains an API key or OAuth access token from the process environment and adds it to every credentialed MCP request. This transmission is necessary for the declared remote MCP functionality when the default AI-HIVE endpoint is used.

However, the credential-bearing destination is also taken from the AI_HIVE_MCP_URL environment variable. The code performs no scheme validation, origin validation, hostname allowlisting, or explicit trust confirmation before attaching the credential. Consequently, a process that can influence the script's environment can redirect the authorization header or API-key header to an unrelated server.

This exceeds the minimum privilege needed for the declared functionality. Supporting a configurable MC ...[truncated 1802 chars]

Remediation
View remediation

Remediation Suggestions

  1. Pin the credential-bearing endpoint. Use the fixed AI-HIVE URL for authenticated requests rather than accepting an unrestricted environment override.
python
MCP_URL = "https://ai-hive.iclip.cn/api/mcp"
  1. If custom endpoints are required, validate them before loading credentials.

    • Require HTTPS.
    • Reject embedded user information.
    • Require the expected hostname and port, or use a narrow explicit allowlist.
    • Normalize and compare the parsed origin before constructing authentication headers.
    • Reject redirects to a different origin.
  2. Separate endpoint selection from credential selection. Associate credentials with a specific trusted origin and never send AI-HIVE credentials to a custom origin automatically.

  3. Require explicit confirmation for non-default endpoints. A custom server should require a separate credential variable and a clear warning rather than reusing AI_HIVE_API_KEY or AI_HIVE_ACCESS_TOKEN.

  4. Disable cross-origin redirect credential forwarding. Use a redirect handler that rejects redirects for authenticated requests, or strips credentials and requires reauthorization after validating the new destination.

  5. Apply least-privilege credentials. Prefer narrowly scoped, short-lived OAuth tokens where supported. Retain the documented revocation procedure and advise immediate revocation after suspected exposure.

  6. Add automated security tests. Verify that HTTP URLs, deceptive subdomains, alternate ports, embedded credentials, and cross-origin redirects cannot receive AI-HIVE authentication headers.

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

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 without validation. If an attacker can influence the execution environment, they can redirect requests—and the API key or bearer token in headers—to an arbitrary endpoint, causing credential exfiltration and unauthorized tool invocation against a rogue server.

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 documented purpose is a constrained car/racing advertising workflow with explicit confirmation checkpoints, but the referenced behavior exposes a generic remote MCP tool-calling surface instead of enforcing that workflow. This mismatch is dangerous because users and orchestrators may trust the description while the implementation can invoke arbitrary remote capabilities, bypass domain restrictions, or perform actions unrelated to ad creation.

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

The skill advertises executable workflows and includes references to scripts, local file output, environment variables, and remote MCP/network access, but it declares no explicit tool scope or allowed-tools boundary. In practice, that means an agent may grant broader capabilities than users expect, increasing the risk of unintended file access, secret handling, or network/tool invocation beyond the narrow advertising use case.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The file’s natural-language instructions are entirely in Chinese, which can impose a language requirement on users or operators without any opt-in mechanism. The policy explicitly flags language or locale constraints unless the skill offers a choice or clearly documents a justified regional limitation.

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 includes user-facing error text in Chinese, and the pattern continues throughout the CLI messages. Because the script does not offer any language selection or opt-in, it enforces a specific language/locale on all users, which matches the natural-language policy violation criteria.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The credential-related SystemExit message is user-facing operational guidance and is written only in Chinese. Since no locale selection or explicit region-specific justification is present in the file, this constitutes a forced language/locale policy violation.

Content

No source excerpt is available for this finding.