Back to skill

Security audit

商品宣传短片|AI-HIVE原创工作流

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches its AI-HIVE ad-making purpose, but it needs Review because its helper can send AI-HIVE credentials to an environment-selected MCP endpoint and call broad remote tools.

Review before installing if you plan to use the local helper. Prefer OAuth through the MCP client, avoid setting AI_HIVE_ACCESS_TOKEN in a shell, and check that AI_HIVE_MCP_URL is unset or exactly the official AI-HIVE endpoint before running list-tools or call. Only use --confirm-paid after verifying the model, tool, arguments, and budget, and revoke the AI-HIVE key immediately if you suspect it was exposed.

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:19
Finding

Unrestricted MCP Endpoint Override Can Expose AI-HIVE Credentials

Content
View full analysis

Vulnerability Details

File Location: scripts/ai_hive_mcp.py, lines 19 and 46–71
Vulnerability Type: Credential disclosure through an unrestricted network destination
Risk Level: High

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 client reads its MCP destination from the unvalidated AI_HIVE_MCP_URL environment variable. It separately reads an API key or OAuth access token from the process environment and unconditionally adds that credential to every MCP POST request.

No validation restricts the configured URL to HTTPS, the documented ai-hive.iclip.cn host, an expected port, or the intended /api/mcp path. Consequently, a manipulated execution environment can redirect authenticated requests to an arbitrary network endpoint.

Credential transmission to the documented AI-HIVE service is necessary for authenticated MCP operations. Permitting an unrestricted destination override is not required ...[truncated 1650 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove AI_HIVE_MCP_URL configurability if custom MCP servers are not an explicit requirement, and use the fixed documented HTTPS endpoint.
  2. If endpoint configuration is required, parse the URL before constructing any authenticated request and enforce:
    • Scheme exactly equal to https.
    • Hostname exactly equal to ai-hive.iclip.cn.
    • No embedded username or password.
    • Only the expected port.
    • Path exactly equal to /api/mcp.
  3. Prevent authenticated requests from following redirects to a different origin. Validate every redirect target or disable redirects and fail closed.
  4. Never attach AI-HIVE credentials to non-allowlisted origins. Separate endpoint selection from credential attachment so authentication headers are only added after origin validation.
  5. If development endpoints are genuinely needed, require an explicit command-line opt-in and separate development credentials rather than production credentials.
  6. Add automated tests covering HTTP URLs, lookalike domains, user-information URLs, unexpected ports, cross-origin redirects, and attacker-controlled hosts.
  7. Document that users should inspect and clear unexpected AI_HIVE_MCP_URL values. If exposure is suspected, revoke the API key or OAuth authorization immediately.
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 authentication material from environment variables to an endpoint whose base URL is also controlled by the AI_HIVE_MCP_URL environment variable. If that variable is altered, API keys or bearer tokens can be transmitted to an attacker-controlled server, causing credential exfiltration and unauthorized use of the connected MCP account.

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 constrained advertising-production workflow, but the described implementation is effectively a generic MCP/OAuth/API access path with broad tool-calling capability and little evidence of enforcing the promised domain restrictions. This mismatch is dangerous because users and orchestrators may trust the narrower description while the skill can invoke more general remote actions, creating a confused-deputy situation and increasing the risk of unauthorized tool use, billing events, or data exposure.

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 concrete operational steps that involve network access, local scripts, local file output, and use of environment-held API keys, but it does not declare any explicit tool scope or allowed-tools boundary. In a skill ecosystem, missing scope declarations weakens least-privilege controls and can let the runtime or downstream agent use broader capabilities than users would reasonably expect, increasing the chance of unintended file, env, or network access.

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 defining trigger constraints, exclusions, or stronger guardrails. In this context, the skill can reach an external MCP that supports marketing, image, and video generation, so accidental or overly broad auto-invocation could cause unintended tool use, user confusion, or progression toward paid/publishing workflows despite the prompt-level warning not to auto-pay or publish.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

This code file contains multiple hard-coded Chinese user-facing messages, starting here, with no indication that the skill is intended only for Chinese-speaking users and no option to select another language. That violates the language/locale policy criterion because the skill imposes a specific language without user opt-in or justification.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest describes a skill for generating advertising materials via AI-HIVE MCP with explicit confirmation for paid, batch, send, and publish actions. This helper additionally implements generic credential acquisition from environment variables, including direct bearer-token use, which is an operational diagnostics/client capability rather than an obvious requirement of ad-asset creation itself.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The helper exposes generic MCP diagnostics and arbitrary tool invocation rather than constraining actions to the advertised workflow. In a skill context, this broadens the accessible attack surface: a user or downstream agent can invoke unintended remote tools, potentially triggering data access, side effects, or billable operations outside the declared purpose.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The command description, subcommand help text, and confirmation guidance are presented in Chinese only. In the absence of a documented regional constraint or a user-selectable locale, this is a natural-language policy issue rather than a code defect.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

The display name, description, and default prompt all assume Chinese-language interaction, but the manifest does not state that the skill is China-specific or that users can opt into another language. This can violate a language or locale policy where skills should not force a specific language without user choice or documented regional justification.

Content

No source excerpt is available for this finding.