Back to skill

Security audit

高级丝巾纹样与马术图形平面设计|AI-HIVE原创工作流

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a disclosed AI-HIVE advertising workflow, but one helper script can send API credentials to an environment-selected server and the activation scope is broad enough to require review before installation.

Install only if you intend to use AI-HIVE for this Chinese-language advertising workflow. Prefer OAuth through the MCP client or keep API keys in a trusted secret store. Do not run the helper script in an environment where AI_HIVE_MCP_URL may be set by someone else; verify it is unset or exactly the official AI-HIVE endpoint before using AI_HIVE_API_KEY or AI_HIVE_ACCESS_TOKEN. Review model prices and approve each paid generation, batch action, send, or public publish step manually.

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

Arbitrary MCP Endpoint Override Can Disclose Authentication Credentials

Content
View full analysis

Vulnerability Details

File Location: scripts/ai_hive_mcp.py, lines 16 and 44–69
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 MCP destination is taken directly from the AI_HIVE_MCP_URL environment variable. The value is not checked for an HTTPS scheme, expected hostname, port, or path. The post() function then unconditionally attaches either the bearer access token or the AI-HIVE API key to requests sent to that destination.

This violates the principle that credentials must be scoped to a trusted origin. Although sending credentials to the declared AI-HIVE MCP service is necessary for the Skill's functionality, allowing the same credentials to be sent to an arbitrary endpoint exceeds minimum privilege.

Depending on redirect behavior, origin-changing HTTP redirects may present an additiona ...[truncated 1471 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove the AI_HIVE_MCP_URL override if custom endpoints are not required. Use the fixed documented endpoint:

    python
    MCP_URL = "https://ai-hive.iclip.cn/api/mcp"
    
  2. If configurability is required, parse and validate the URL before creating an authenticated request. Require:

    • Scheme exactly equal to https
    • Hostname exactly equal to ai-hive.iclip.cn
    • Expected HTTPS port
    • Path exactly equal to /api/mcp
    • No embedded username or password
    • No untrusted fragments or ambiguous URL forms
  3. Bind credential selection to the validated destination. Never add AI-HIVE authentication headers to requests targeting another origin.

  4. Disable automatic redirects for authenticated requests or implement a redirect handler that rejects every cross-origin redirect. Revalidate the destination before forwarding credentials.

  5. If custom MCP servers must be supported, require separate credentials explicitly scoped to each configured origin. Do not reuse AI_HIVE_API_KEY or AI_HIVE_ACCESS_TOKEN.

  6. Add automated tests covering malicious overrides, including HTTP URLs, look-alike domains, alternate ports, user-info syntax, and redirects to another host.

  7. Document that users who may have executed the script with an untrusted endpoint should immediately revoke and rotate the affected API key or OAuth token and review account activity.

Vulnerability Patterns
  • 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
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
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

post() sends authentication material from environment variables (AI_HIVE_API_KEY or AI_HIVE_ACCESS_TOKEN) to MCP_URL, and MCP_URL itself is overridable via the AI_HIVE_MCP_URL environment variable. If an attacker can influence that environment variable or execution environment, they can redirect requests to an arbitrary server and capture the bearer token or API key, causing credential exfiltration and unauthorized API use.

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

The declared purpose is a narrow creative-advertising workflow, but the referenced behavior includes generic MCP/OAuth connectivity diagnostics and arbitrary tool invocation. This mismatch is dangerous because users may grant trust and credentials for a limited marketing task while the skill actually enables broader authenticated access and tool use beyond that stated scope.

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

The skill exposes network, file read/write, and environment-backed execution capabilities but does not declare any explicit tool scope or allowed-tools boundary. In practice this weakens least-privilege controls, making it easier for the skill or a downstream prompt injection to invoke broader functionality than users would expect from an advertising-design workflow.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The invocation description says the skill should be used when the user searches for broad terms like '商业广告', 'AI图片', 'AI视频', and '短视频制作'. These phrases are common, high-level intents that could match many unrelated requests, and the file does not provide negative examples or clear exclusion boundaries for when this skill should not activate.

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 tight trigger constraints, which can cause the agent to call this advertising workflow automatically in situations where the user did not clearly intend it. Because the skill connects to an external MCP service capable of generating marketing/media outputs and querying live model offerings, unintended invocation increases the risk of unnecessary external data exposure, unexpected tool use, and downstream actions being prepared without sufficiently explicit user consent.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This Python file contains multiple user-facing error/help strings in Chinese, including command descriptions and runtime errors, without any indication that language is configurable or region-specific. That creates a natural-language policy issue because the skill effectively forces a specific locale on all users without opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This code embeds user-facing default metadata entirely in Chinese, including the title, category, outcome, deliverables, and metrics, with no option for the user to choose language or locale. That creates a natural-language policy concern because the skill appears to impose a specific language by default rather than offering opt-in or documenting a justified region-specific constraint.

Content

No source excerpt is available for this finding.