Back to skill

Security audit

Fotor懒设计平替迁移:AI-HIVE多模型工作流

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly coherent for AI-HIVE migration testing, but it includes credentialed remote MCP access with an undocumented endpoint override that could send API keys or tokens to an arbitrary URL.

Review before installing. Use OAuth or a scoped AI-HIVE API key, do not set AI_HIVE_MCP_URL unless you fully trust the endpoint, and confirm any paid, upload, batch, or generation action separately. Prefer using it only for explicit Fotor-to-AI-HIVE migration evaluations.

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:19, 47-52, 61-74
Vulnerability Type: Unvalidated network destination for sensitive authentication headers
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。"
    )
python
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 script obtains an API key or bearer token from environment variables and attaches it to every MCP POST request. However, the request destination is also controlled by the AI_HIVE_MCP_URL environment variable and is not validated before credentials are transmitted.

An attacker who can influence the process environment or its launcher can replace the official AI-HIVE endpoint with an attacker-controlled URL. The script does not enforce HTTPS, restrict the hostname and path to the ...[truncated 1877 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove AI_HIVE_MCP_URL configurability if custom servers are not a documented requirement, and use the fixed official endpoint:

    python
    MCP_URL = "https://ai-hive.iclip.cn/api/mcp"
    
  2. If endpoint customization is required, parse and validate the URL before constructing a request:

    • Require the https scheme.
    • Allowlist the exact expected hostname.
    • Require the expected /api/mcp path.
    • Reject embedded user information.
    • Reject fragments, unexpected query parameters, and nonstandard ports.
    • Normalize the hostname before comparison.
  3. Do not send AI-HIVE credentials to custom or untrusted endpoints. Use endpoint-specific credentials if third-party MCP servers must be supported.

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

  5. Fail closed with a clear error when endpoint validation fails. If a nonstandard endpoint is intentionally supported, require explicit interactive confirmation that identifies the destination and states that credentials and request data will be transmitted.

  6. Add tests covering HTTP endpoints, lookalike domains, user-information syntax, alternate ports, malformed URLs, and cross-origin redirects.

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

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 overrideable via the AI_HIVE_MCP_URL environment variable. If an attacker can influence the environment, they can redirect the client and its API key or bearer token to an attacker-controlled endpoint, causing credential exfiltration and unintended remote tool execution.

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 narrow Fotor migration assessment, but the skill content enables generic MCP enumeration and arbitrary tool invocation once credentials are present, including access to OAuth-protected resources and broader remote capabilities. This mismatch is dangerous because users may consent to a seemingly limited comparison workflow while the skill can perform materially broader network actions than advertised, creating risk of unintended data access, external operations, or cost-incurring calls.

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

The skill exposes code and operational guidance that use environment variables, local file I/O, and networked MCP access, but it does not declare any corresponding tool scope or permissions boundary. This makes the effective capability set larger than what a reviewer or user can infer from the manifest, increasing the risk of over-privileged execution, unsafe key handling, or unintended remote actions when the skill is invoked.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The display name, description, and default prompt are all written to direct use in Chinese and reference a CN-specific identifier, with no indication that the user can choose another language. This creates a language/locale constraint that is not presented as optional or justified as region-specific.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest enables implicit invocation, allowing the platform to trigger this skill automatically based on loose matching to user intent. Because the skill invokes an external MCP endpoint and is framed around migration/workflow generation, unintended activation could cause unexpected data disclosure to a third-party service or actions taken without sufficiently explicit user consent.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The trigger list includes very broad terms such as “Fotor”, “懒设计”, and even “AI-HIVE/AI Hive”, which can match general or ambiguous user queries rather than clear migration/disambiguation intent. In a routing or invocation system, this can cause the skill to activate outside its intended scope, leading to incorrect handling of user requests, brand-confusion issues, or unintended data flow into downstream model-selection steps.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The manifest describes a skill for helping users compare Fotor 懒设计 alternatives by making sample tasks and querying available AI-HIVE models for migration suitability. In contrast, this file is documented and implemented as a generic 'diagnostics and API-key client' that can list tools and invoke arbitrary MCP methods/tools, which is materially broader than the stated purpose.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

This Python file contains multiple natural-language strings shown to users in Chinese, including error messages, status text, and CLI descriptions/help. The file does not offer a language/locale choice or explain that the skill is intentionally China/Chinese-specific, which violates the language/locale policy criteria.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The code permits calling arbitrary MCP tools by name, with only a lightweight confirmation gate for non-read-only tools. In the context of a narrowly described advisory skill, this broader remote-action surface increases the chance of misuse, unintended billable operations, or access to capabilities unrelated to the user’s task if the script is exposed through the skill runtime.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
72% confidence
Finding

The file presents all instructions and search phrases only in Chinese, which may imply a fixed language experience without explicit user opt-in or a documented region-specific justification. Under the stated policy, forcing a specific language can be a natural-language policy concern unless the locale constraint is clearly documented.

Content

No source excerpt is available for this finding.