Back to skill

Security audit

AI大模型专家|Agent Harness 工程|AI-HIVE

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly coherent for AI-HIVE planning, but it uses an API key with an under-disclosed endpoint override and broad implicit activation.

Review this before installing if your environment contains AI_HIVE_API_KEY. Only use it with the official AI-HIVE endpoint, avoid setting AI_HIVE_BASE_URL unless you fully trust the destination, and consider disabling implicit invocation or narrowing triggers so ordinary API or workflow questions are not routed through this skill.

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 Credential Disclosure Through an Unrestricted Endpoint Override

Content
View full analysis

Vulnerability Details

File Location: scripts/ai_hive_hotspot.py, lines 25–29
Vulnerability Type: Unvalidated destination for authenticated requests
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 destination base URL directly from the AI_HIVE_BASE_URL environment variable without validating its scheme, hostname, port, or embedded credentials. It then attaches the value of AI_HIVE_API_KEY as a bearer token to a request sent to that destination.

If an attacker can influence the process environment or provide a malicious execution wrapper, the authenticated request can be redirected to an attacker-controlled server. That server would receive the API key in the Authorization header. The weakness crosses a credential trust boundary: a credential intended for the legitimate AI-HIVE service can be forwarded to an arbitrary endpoint.

Attack Path

  1. The attacker gains the ability to influence AI_HIVE_BASE_URL, such as through a compromised shell profile, CI/CD variable, container configuration, wrapper script, or copied command.
  2. The attacker sets the variable to an endpoint under their control, for example https://attacker.example.
  3. The victim retains a valid secret in AI_HIVE_API_KEY and runs the models subcommand.
  4. The script constructs https://attacker.example/openapi/v1/models.
  5. It sends an HTTP request containing Authorization: Bearer <AI_HIVE_API_KEY>.
  6. The attacker records the header and attempts to use the exposed credential against the legitimate AI-HIVE service.

Exploitation requires influence over the command's envi ...[truncated 672 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove the AI_HIVE_BASE_URL override if alternate service endpoints are not a required feature.
  2. If configurability is required, parse the URL and enforce:
    • The https scheme.
    • An explicit allowlist of trusted hostnames.
    • Approved ports only.
    • No embedded username or password.
    • No fragments or unexpected path components.
  3. Disable automatic redirects or validate every redirect destination before following it. Never forward the Authorization header to a host outside the allowlist.
  4. Bind credentials to endpoint-specific configuration rather than combining an arbitrary base URL with a globally sourced API key.
  5. Fail closed with a clear error whenever endpoint validation fails.
  6. Document that endpoint overrides are security-sensitive and should only be supplied through trusted deployment configuration.
  7. Rotate any API key that may have been used while an untrusted AI_HIVE_BASE_URL was configured, and review service-side usage and billing logs for misuse.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • 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 (7)

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

The skill promises runtime model/price checks, routing decisions, task tracking, and structured deliverables, but the referenced commands only generate and validate a plan template. This mismatch can mislead operators into believing cost controls, routing, and audit logging are actually enforced, creating a false sense of safety and potentially causing unreviewed execution decisions or missing accountability.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill references commands that use environment variables, local files, and network access, but it does not declare an explicit tool scope such as allowed-tools or permissions. This creates an authorization gap where a host agent may over-grant capabilities, increasing the chance of unintended data access, secret exposure, or network actions beyond the skill's stated purpose.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The metadata sets language: zh-CN, which indicates a fixed language/locale. Under the policy, forcing a specific language without user choice or documented justification can be a natural-language policy violation.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The search coverage list includes broad terms such as “教程、怎么用、接入、API、MCP、Agent、工作流、自动化”, which are generic phrases used in many unrelated contexts. Without explicit exclusion conditions or narrower constraints, these triggers could cause unintended invocation for ordinary platform, API, or workflow questions.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The default prompt begins with a Chinese instruction ('使用 ... 先输出...'), indicating a fixed language/locale behavior. There is no visible opt-in, language selection, or justification that this skill is intentionally limited to a Chinese-speaking context.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill enables implicit invocation with no scoped trigger constraints, exclusions, or safety guardrails. In this context, the skill is designed to influence planning, model routing, task execution, and record persistence via AI-HIVE, so unintended auto-invocation could cause the agent to route sensitive requests into this skill, perform actions the user did not explicitly request, or bias workflows toward external model selection and logging.

Content

No source excerpt is available for this finding.