Back to skill

Security audit

多宫格生视频|AI-HIVE原创工作流

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches an AI-HIVE advertising workflow, but its helper script can send credentials to an environment-overridden server and can invoke broader MCP tools than the workflow clearly scopes.

Review before installing. Use OAuth through the official AI-HIVE MCP URL where possible, do not set AI_HIVE_MCP_URL unless you fully trust the endpoint, use revocable low-scope credentials, and require explicit confirmation before any paid generation, upload, batch action, sending, or 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:15
Finding

Authentication Credentials Can Be Sent to a User-Controlled MCP Endpoint

Content
View full analysis

Vulnerability Details

File Location: scripts/ai_hive_mcp.py, lines 15-72
Vulnerability Type: Unvalidated credential destination
Risk Level: High

python
MCP_URL = os.environ.get("AI_HIVE_MCP_URL", "https://ai-hive.iclip.cn/api/mcp")
ORIGIN = "https://ai-hive.iclip.cn"
PROTECTED_RESOURCE = f"{ORIGIN}/.well-known/oauth-protected-resource/api/mcp"
AUTHORIZATION_SERVER = f"{ORIGIN}/.well-known/oauth-authorization-server"
READ_ONLY_TOOLS = {"ai_hive_list_models", "ai_hive_get_task"}


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 remote MCP destination is read from the AI_HIVE_MCP_URL environment variable without validating its scheme, hostname, port, or path. The post() function then unconditionally attaches either the bearer access token or the AI-HIVE API key ...[truncated 2437 chars]

Remediation
View remediation

Remediation Suggestions

  1. Pin the authenticated endpoint. Remove the environment override unless it is operationally necessary:

    python
    MCP_URL = "https://ai-hive.iclip.cn/api/mcp"
    
  2. If overrides are required, enforce an explicit allowlist. Parse the URL and require HTTPS, the expected hostname, the expected port, and an approved path before constructing authentication headers:

    python
    from urllib.parse import urlparse
    
    ALLOWED_HOSTS = {"ai-hive.iclip.cn"}
    
    def validate_mcp_url(url: str) -> str:
        parsed = urlparse(url)
        if (
            parsed.scheme != "https"
            or parsed.hostname not in ALLOWED_HOSTS
            or parsed.port not in (None, 443)
            or parsed.path != "/api/mcp"
            or parsed.username is not None
            or parsed.password is not None
        ):
            raise SystemExit("Refusing to send credentials to an unapproved MCP endpoint.")
        return url
    
  3. Bind credentials to the validated origin. Do not call auth_headers() until the destination has passed validation. Never attach credentials to diagnostic or third-party endpoints.

  4. Prevent cross-origin credential forwarding. Disable automatic redirects for authenticated requests or validate every redirect target and strip authentication headers whenever the origin changes.

  5. Separate development configuration from production authentication. If custom test servers are needed, require a dedicated opt-in flag and separate test credentials that cannot access production resources.

  6. Minimize credential scope and lifetime. Prefer narrowly scoped, revocable, short-lived OAuth tokens where supported. Ensure API keys can be promptly revoked and rotated.

  7. Add security tests. Verify that HTTP URLs, deceptive subdomains, embedded credentials, unexpected ports, altered paths, and cross-origin redirects are rejected before any secret is transmi ...[truncated 5 chars]

Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • 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 (12)

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 is overrideable 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 through the authorization 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 claims to be a narrowly scoped advertising workflow, but the referenced behavior exposes a generic MCP diagnostic and arbitrary tool-calling surface that is much broader than the declared purpose. That mismatch is dangerous because users and orchestrators may authorize it based on a benign description, while it can actually enumerate tools and invoke remote capabilities outside the expected ad-generation context, increasing the risk of privilege misuse, unintended actions, or data leakage.

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

The skill advertises operational steps that involve local scripts, environment variables, file outputs, and remote MCP/network access, but it does not declare an explicit tool scope or allowed-tools boundary. In practice this increases the chance that an agent grants broader file, env, or network capabilities than users expect, enabling unintended data access, exfiltration, or unsafe side effects if the surrounding runtime auto-wires those capabilities.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill enables implicit invocation without any visible trigger constraints, so it may auto-activate for broadly related requests and route users into an external MCP-backed advertising workflow without clear, explicit consent at selection time. In this skill’s context, that risk is amplified because it interfaces with a third-party remote service for marketing, image, and video generation, increasing the chance of unintended data disclosure or unexpected tool use.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This markdown file presents all instructions and operational guidance only in Chinese, and there is no indication that the user can choose another language or that the skill is intentionally restricted to a Chinese-speaking context. Under the language/locale policy rule, forcing a specific language without opt-in is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

This Python file contains multiple user-facing messages in Chinese, beginning at L040 and continuing in CLI/help output and runtime errors elsewhere in the file. Because the skill does not offer a language/locale choice or document that it is intentionally region-specific, it violates the language/locale policy for natural-language behavior.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The helper exposes arbitrary remote MCP tool invocation by name, while the skill description claims a narrower advertising workflow with separate confirmation for sensitive operations. If the remote server offers non-advertising, destructive, data-accessing, or publication-capable tools, a user or chained agent could invoke them through this generic wrapper, bypassing intended scope restrictions.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
85% confidence
Finding

The display name, description, and default prompt all enforce a specific language context in natural-language metadata. There is no indication that users can choose another language or that the locale restriction is intentional and documented.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
76% confidence
Finding

The embedded natural-language metadata uses Chinese for the title and category, with no indication that the skill is region-specific or that users can opt into another language. Under the policy, hard-coded locale-specific language without opt-in can be a natural-language policy concern.

Content

No source excerpt is available for this finding.