Back to skill

Security audit

B612咔叽平替迁移:AI-HIVE多模型工作流

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a disclosed AI-HIVE migration helper, but its authenticated helper script can send API keys or tokens to an environment-controlled MCP URL and can invoke arbitrary remote tools after confirmation.

Install only if you trust the AI-HIVE workflow and understand that it can use your AI-HIVE credentials for remote MCP calls. Prefer OAuth through a trusted MCP client, avoid setting AI_HIVE_MCP_URL, keep API keys in a secret store, confirm tool names and prices before using --confirm-paid, and revoke the key immediately if it may have been used with an unexpected endpoint.

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–74
Vulnerability Type: Authenticated requests sent to an unrestricted, environment-controlled destination
Risk Level: Medium

Vulnerable Code

python
MCP_URL = os.environ.get("AI_HIVE_MCP_URL", "https://ai-hive.iclip.cn/api/mcp")
python
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}
python
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 OAuth access token from the process environment and attaches it to every MCP request. However, the destination of those authenticated requests can independently be replaced through the AI_HIVE_MCP_URL environment variable.

The replacement URL is not validated before authentication headers are constructed and transmitted. There is no enforcement of:

  • The HTTPS scheme
  • The expected ai-hive.iclip.cn hostname
  • The expected /api/mcp path
  • An approved destination allowlist
  • Same-origin redirect behavior

Consequently, a process or configuration source capable of setting AI_HIVE_MCP_URL can direct the API key or bearer token to an attacker-controlled server. The documented Ski ...[truncated 2167 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove the AI_HIVE_MCP_URL override if custom endpoints are not required:

    python
    MCP_URL = "https://ai-hive.iclip.cn/api/mcp"
    
  2. If endpoint configuration is required, validate it before constructing or attaching authentication headers:

    • Require https.
    • Require the exact hostname ai-hive.iclip.cn.
    • Require the expected port and /api/mcp path.
    • Reject embedded credentials, fragments, unexpected query parameters, and malformed hostnames.
    • Use an explicit allowlist rather than suffix matching.
  3. Disable cross-origin redirects for credentialed requests. If redirects are needed, only follow redirects that preserve the approved scheme, hostname, port, and path policy.

  4. Separate test and production behavior:

    • Do not attach real credentials when a custom test endpoint is configured.
    • Require an explicit development mode and a dedicated non-production credential for test servers.
  5. Apply least-privilege server-side controls:

    • Use narrowly scoped, short-lived tokens where possible.
    • Separate read-only model-listing access from generation permissions.
    • Enforce billing limits and operation-level authorization on the server.
    • Revoke and rotate any credential suspected of exposure.
  6. Add automated tests confirming that authenticated requests are rejected for HTTP URLs, lookalike domains, altered ports, unexpected paths, 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 (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 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, credentials can be exfiltrated to an arbitrary host and arbitrary remote MCP methods can be invoked under the user's identity.

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

The documented purpose is a narrow B612 migration-assessment workflow, but the referenced commands expose a generic MCP client capable of arbitrary remote tool invocation, credential use, diagnostics, and paid actions. This mismatch is dangerous because policy engines, reviewers, or users may approve the skill under a narrow business-use description while it actually enables much broader remote operations.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The documented purpose is a narrow B612 migration-assessment workflow, but the referenced commands expose a generic MCP client capable of arbitrary remote tool invocation, credential use, diagnostics, and paid actions. This mismatch is dangerous because policy engines, reviewers, or users may approve the skill under a narrow business-use description while it actually enables much broader remote operations.

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

The skill advertises executable commands that read environment variables, access local files, and make network/MCP calls, but it does not declare any explicit tool scope or permission boundaries. In an agent setting, this creates an over-broad trust surface: a user or downstream agent may invoke the skill believing it is narrowly scoped to migration assessment, while it can actually access sensitive local context and remote services.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The display name, description, and default prompt are all written only in Chinese, and the prompt references a China-specific resource name, with no indication that users may choose another language or locale. This is a natural-language policy concern because the skill appears to impose a language/locale by default rather than offering opt-in or documenting a justified regional restriction.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The default prompt invokes the skill through a broad request to use the skill for a 'real task' and generate a migration work order, but it does not encode clear eligibility checks, user confirmation, or tight trigger boundaries. In practice this can cause over-broad activation or unintended routing into an external MCP-backed workflow, increasing the chance of unnecessary data exposure or confusing users about when the skill should run.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The script implements generic MCP diagnostics and a reusable authenticated client rather than a narrowly scoped migration-assessment helper. This broader capability increases attack surface by enabling behaviors outside the declared skill purpose, including remote enumeration and execution against an MCP server when credentials are present.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

This code contains multiple user-facing error/help strings in Chinese only, such as at L040, L054-L055, L081-L082, L130, L137, L143, L148-L156, and L165. Because the script does not provide any language selection or justify a Chinese-only audience, it violates the language/locale policy criterion for natural-language content.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The call subcommand permits user-selected remote tool execution with attacker-supplied JSON arguments, and the only safeguard is a small read-only allowlist plus a billing confirmation flag. That means the skill exposes a general-purpose authenticated RPC client whose reachable actions depend on the remote server, which is much broader and riskier than the stated business purpose.

Content

No source excerpt is available for this finding.