Back to skill

Security audit

原创IP全案设计(潮玩视觉语言)|AI-HIVE原创工作流

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches its AI-HIVE advertising workflow, but it needs review because its helper can send API credentials to an environment-selected endpoint and can invoke broader MCP tools than the workflow requires.

Review this before installing if you will use API keys or paid AI-HIVE generation. Prefer OAuth through a trusted MCP client, avoid setting AI_HIVE_MCP_URL, verify any environment or launcher configuration before running the helper, and confirm each paid, batch, send, or publish action yourself.

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

Environment-Controlled MCP Endpoint Can Exfiltrate API Credentials

Content
View full analysis

Vulnerability Details

File Location: scripts/ai_hive_mcp.py, lines 17 and 44–70
Vulnerability Type: Unvalidated credential 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 the MCP destination from the AI_HIVE_MCP_URL environment variable while independently obtaining an API key or OAuth access token from other environment variables. Every call made through post() automatically attaches that credential to the configured destination.

No validation ensures that the destination:

  • Uses HTTPS.
  • Belongs to the documented ai-hive.iclip.cn host.
  • Uses the expected /api/mcp path.
  • Was explicitly approved before receiving the credential.

Endpoint configurability may be useful for testing, but coupling an unrestricted endpoint override with automatic credential forwarding violates least-privilege credential handling. The declared production functionality only requires sending AI-HIVE credentials to the documented AI-HIVE se ...[truncated 1498 chars]

Remediation
View remediation

Remediation Suggestions

  1. Pin credential-bearing requests to the trusted production endpoint

    python
    MCP_URL = "https://ai-hive.iclip.cn/api/mcp"
    
  2. If custom endpoints are required, enforce a strict allowlist

    • Parse the URL with urllib.parse.urlparse.
    • Require the https scheme.
    • Require the exact expected hostname and port.
    • Require the expected MCP path.
    • Reject embedded usernames, passwords, fragments, and unexpected query parameters.
  3. Do not reuse production credentials for custom endpoints

    • Introduce separate environment variables for development endpoints and development credentials.
    • Refuse to attach AI_HIVE_API_KEY or AI_HIVE_ACCESS_TOKEN when the destination is not the production host.
  4. Require explicit authorization for endpoint overrides

    • Use a command-line option such as --allow-custom-endpoint.
    • Display the destination hostname and require confirmation before transmitting any credential.
    • Fail closed in non-interactive environments unless an explicit secure override is provided.
  5. Apply redirect restrictions

    • Ensure credential-bearing requests cannot be redirected to an untrusted host.
    • Revalidate the scheme and hostname for every redirect target before forwarding authentication headers.
  6. Use scoped and revocable credentials

    • Prefer narrowly scoped OAuth tokens over broadly privileged API keys.
    • Avoid granting generation or billing capabilities when only model listing is needed.
    • Rotate and revoke credentials immediately if endpoint manipulation or leakage is suspected.
  7. Add automated security tests

    • Verify that HTTP destinations are rejected.
    • Verify that foreign hostnames are rejected.
    • Verify that credentials are never attached to custom or redirected destinations.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • 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
Findings (16)

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 allows AI_HIVE_MCP_URL to be overridden from the environment and then sends authentication material from AI_HIVE_API_KEY or AI_HIVE_ACCESS_TOKEN to that URL in request headers. If an attacker can influence the environment or wrapper configuration, they can redirect requests to an arbitrary host and capture credentials, making this effectively an exfiltration/SSRF-style sink.

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 declared purpose is a bounded advertising/IP-design workflow, but the referenced behavior indicates generic MCP/OAuth diagnosis and arbitrary tool invocation capability. That mismatch is dangerous because users may grant trust and credentials under the assumption of a limited creative workflow while the implementation can enumerate and call broader tools, and the stated confirmation controls do not specifically enforce restrictions for batch, send, or publish actions.

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

The skill exposes or references capabilities requiring environment access, file read/write, and network access without an explicit tool-scope declaration constraining what may be invoked. In this context, the document also instructs users to run local scripts and configure credentials, so the absence of an allowlist weakens containment and can let a supposedly narrow advertising workflow invoke broader local or remote actions than users expect.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The description says the skill should be used when the user searches for terms like “商业广告”, “AI图片”, “AI视频”, and “短视频制作”. These are broad, generic phrases that can match many everyday creative requests beyond this skill’s narrowly defined purpose, increasing the risk of unintended invocation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

Natural-language text in the display name, description, and default prompt is entirely Chinese, and the prompt instructs the model directly in that language without offering a locale choice. This can violate language/locale policy when the skill is presented to a broader user base without explicit opt-in or justification.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill enables implicit invocation with no trigger constraints, exclusions, or tighter scope controls. That creates a real risk the agent will auto-select this skill in loosely related requests and reach an external MCP-backed advertising generation service, increasing the chance of unintended tool use, unreviewed external data handling, or accidental progression toward paid or publish-capable workflows.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This code file contains user-facing error text in Chinese, and similar Chinese-only strings appear throughout the CLI. The policy requires flagging language or locale constraints when the skill forces a specific language without user opt-in, and this script does not offer any language selection or justify a Chinese-only audience.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The missing-credential message is a primary user-facing instruction path, but it is written only in Chinese. Because the file provides no locale choice or justification for restricting messages to Chinese, this is a natural-language policy violation under the language/locale rule.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The argparse description, subcommand help, and safety-related confirmation help are all user-facing operational text, and they are only in Chinese. Since the script does not offer language choice or explain a justified locale restriction, it enforces a language policy constraint.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The manifest describes a skill for advertising/IP design workflows that should first query models/prices and then generate ad materials with separate confirmation for paid generation, batching, sending, and public release. In code, the CLI exposes generic list-tools and call operations and forwards any user-supplied tool name and arguments to the remote MCP service, which is broader than the described purpose and not limited to advertising-related actions.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The embedded natural-language skill metadata is entirely in Chinese, including the title, category, outcome, deliverables, and metrics, with no indication that language selection is optional or user-configurable. This can constitute a language/locale policy violation because it implicitly fixes the skill's language without documented opt-in or justification.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The manifest sets language: zh-CN, and the file content is entirely presented in Chinese without indicating that users may choose another language. This can violate language/locale policy when no user opt-in or justification for the locale restriction is provided.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

This code writes a JSON work-order file to disk via Path(args.output).write_text, but the script provides no confirmation prompt, warning message, or explanatory comment/docstring about modifying the local filesystem beyond the high-level module docstring. For a code file, file writes are safety-relevant operations and should include some visible disclosure unless clearly communicated to the user.

Content

No source excerpt is available for this finding.