Back to skill

Security audit

影飞Clipfly平替迁移:AI-HIVE多模型工作流

Security checks for vulnerabilities and agentic risk

Overview

The skill has a coherent AI-HIVE migration purpose, but it needs Review because its helper script can send AI-HIVE credentials to an environment-controlled endpoint.

Install only if you intend to use AI-HIVE for this migration workflow. Prefer OAuth through the MCP client, avoid setting AI_HIVE_MCP_URL, verify the endpoint is https://ai-hive.iclip.cn/api/mcp before using an API key, and use --confirm-paid only after checking tool name, inputs, budget, and authorization.

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

Environment-Controlled MCP Endpoint Can Receive API Credentials

Content
View full analysis

Vulnerability Details

File Location: scripts/ai_hive_mcp.py, lines 19 and 46–70
Vulnerability Type: Credential disclosure 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",
    )

Technical Analysis

The MCP destination is read directly from the AI_HIVE_MCP_URL environment variable. The value is not restricted to HTTPS and is not checked against the documented AI-HIVE hostname or origin.

At the same time, every request made by post() unconditionally includes either the bearer access token or the API key returned by auth_headers(). User-selected tool arguments are also serialized into the request body.

Consequently, a manipulated or unexpectedly inherited environment can redirect both credentials and request data to an arbitrary server. Allowing an unrestricted endpoint override exceeds the minimum privileges required for this Skill because its declared functionality uses only the official https://ai-hive.iclip.cn/api/mcp service.

...[truncated 1493 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove the AI_HIVE_MCP_URL override if alternative MCP servers are not required:
python
MCP_URL = "https://ai-hive.iclip.cn/api/mcp"
  1. If endpoint configurability is required, validate the parsed destination before attaching credentials:
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.username is not None
        or parsed.password is not None
    ):
        raise SystemExit("Refusing to send credentials to an unapproved MCP endpoint.")
    return url
  1. Bind credentials to an exact approved origin. Do not attach the API key or bearer token when the request destination differs from https://ai-hive.iclip.cn.

  2. Disable or carefully validate HTTP redirects for authenticated requests so credentials cannot be forwarded to another origin.

  3. Require an explicit command-line opt-in for any nonproduction endpoint, and use separate test credentials with minimal permissions rather than production credentials.

  4. Document that users should clear unexpected AI_HIVE_MCP_URL values and inspect inherited environments when running the helper from wrappers, CI systems, or shared shells.

  5. Prefer short-lived, narrowly scoped OAuth tokens where supported, and retain the existing guidance for immediate credential revocation after suspected exposure.

Vulnerability Patterns
  • 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
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
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
90% confidence
Finding

The script posts credentials from environment variables to MCP_URL, which is also environment-controlled. If an attacker can influence AI_HIVE_MCP_URL or the execution environment, they can redirect requests to an attacker-controlled server and capture the API key or bearer token, making this a credential exfiltration/SSRF-style risk.

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

The declared purpose is a constrained migration-assessment workflow, but the embedded commands expose a generic remote tool invocation surface (call with arbitrary tool names), authenticated via environment-provided credentials and capable of invoking potentially billable or side-effecting MCP operations. That mismatch is dangerous because users or supervising agents may trust the narrow description while the skill can actually perform broader remote actions, increasing the risk of unauthorized API use, unintended charges, or data being sent to external services.

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

The skill documents executable commands that use environment variables, local file access, and outbound network access, yet it declares no explicit tool scope or allowed-tools boundary. In an agent environment, this broad undeclared capability increases the chance of over-privileged execution, unintended data exposure, or misuse of local/remote resources beyond the user’s expected migration-evaluation task.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
81% confidence
Finding

The display name, description, and default prompt are all written in Chinese, and the referenced variable name also appears locale-specific, but there is no indication that language selection is optional or user-configurable. This can violate language or locale policy if the skill implicitly assumes a specific language without explicit opt-in.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The default prompt triggers the skill through broad natural-language phrasing and directly encourages use of the external AI-HIVE MCP workflow without narrowly scoped conditions or explicit user confirmation. This increases the chance of accidental invocation, unintended routing of user tasks to the external service, and over-collection or disclosure of sensitive task content during migration assessment.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The trigger list is broad enough to match generic queries such as tutorials, alternatives, or migration help, which can cause the skill to activate outside its narrowly intended scope. In an agent setting, overbroad activation can misroute user requests, expose unrelated workflows to this skill's behavior, and increase the chance of unintended brand-association or misleading migration guidance.

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 emits multiple user-facing error/help strings in Chinese, including runtime errors, credential guidance, diagnostics, and confirmation text. Because the file provides no user opt-in, locale selection, or documented region-specific justification, it violates the language/locale policy criterion.

Content

No source excerpt is available for this finding.