Back to skill

Security audit

用AI模拟同济子豪兄|AI-HIVE

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly describes a real AI-HIVE content workflow, but its helper scripts can send AI-HIVE credentials to environment-configured endpoints that are not validated.

Review before installing. Use OAuth or a secret store where possible, avoid keeping broad AI-HIVE credentials in a shared shell, do not set AI_HIVE_MCP_URL or AI_HIVE_BASE_URL unless you fully trust the destination, and confirm model, price, quantity, and budget before any upload or generation task.

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

Authenticated requests can be redirected to arbitrary endpoints through environment variables

Content
View full analysis
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", ) 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 ``` From `scripts/ai_hive_creator.py`: ```python DEFAULT_BASE = "https://ai-hive.iclip.cn/api" def models(args): key = os.environ.get("AI_HIVE_API_KEY") if not key: raise SystemExit("缺少 AI_HIVE_API_KEY;请只在安全环境变量中配置。") 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={"Au ...[truncated 3793 chars]
Remediation
View remediation
str: parsed = urlparse(value) if parsed.scheme != "https": raise SystemExit("The AI-HIVE endpoint must use HTTPS.") if parsed.hostname not in ALLOWED_HOSTS: raise SystemExit("The AI-HIVE endpoint host is not trusted.") if parsed.username or parsed.password: raise SystemExit("Embedded URL credentials are not allowed.") if parsed.port not in (None, 443): raise SystemExit("A nonstandard endpoint port is not allowed.") if not parsed.path.startswith(expected_path): raise SystemExit("The AI-HIVE endpoint path is not allowed.") return value ``` 2. **Remove endpoint overrides unless they are operationally required** For production use, hardcode the reviewed AI-HIVE endpoint. If development endpoints are necessary, place them behind an explicit development-only option rather than silently trusting general environment variables. 3. **Do not send production credentials to custom endpoints** If custom hosts must remain supported, require a separate credential variable for them and refuse to attach `AI_HIVE_API_KEY` or `AI_HIVE_ACCESS_TOKEN`. Display the final destination and require explicit interactive confirmation before transmitting any credential. 4. **Control redirects** Prevent authorization headers from being forwarded across host boundaries. Reject redirects whose destination differs from the validated origin. Revalidate the scheme and host after every redirect. 5. ** ...[truncated 800 chars]
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 (14)

Tainted flow: 'req' from os.environ.get (line 24, 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_creator.py (reported line 26)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

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

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 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 frames the skill as content-methodology analysis, but the embedded instructions also enable authenticated remote MCP access, tool discovery, and potentially billable task execution. This mismatch is dangerous because users or host agents may treat it as a low-risk analysis skill while it can actually consume credentials, contact external services, and trigger paid 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 的客户端

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script exposes a generic MCP tool invoker and tool lister that are broader than the skill's declared Tongji Zihao methodology-analysis purpose. This expands the skill's effective capability surface to whatever remote tools the MCP server offers, creating a scope mismatch that could enable unintended data access, external actions, or billed operations if integrated into an agent workflow.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill documents executable workflows that use environment variables, local scripts, file I/O, and network access, but it does not declare an explicit tool scope or permission boundary. In an agent environment, this can lead to overbroad capability exposure, making it easier for the skill to access local secrets, read/write files, or initiate network actions beyond what a user reasonably expects.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill enables implicit invocation without any trigger constraints, exclusions, or user confirmation guardrails. Because this skill can steer users into using an external MCP service and generate derivative strategic/content outputs, broad auto-invocation increases the chance of unintended activation, unexpected data sharing to the remote tool, or use in contexts the user did not explicitly request.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The skill’s purpose is content/methodology analysis and content generation grounded in public materials, not MCP connectivity diagnostics or OAuth server inspection. The doctor flow fetches protected-resource and authorization-server metadata and reports connection/auth features, which is an infrastructure capability unrelated to the user-facing simulation/analysis purpose.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The manifest sets language: zh-CN, and the skill content is entirely presented in Chinese without indicating that users may choose another language. Under the policy rule for natural-language violations, forcing a specific language without opt-in can be a locale-policy issue unless clearly justified as region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The display name, description, and default prompt are all written to operate in Chinese, with no indication that users may choose another language or locale. This may violate language/locale policy where user choice or explicit justification is required.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The plan command writes structured output to a filesystem path via write_text, which can create or overwrite a local file. While the operation is part of the command's purpose, this code path contains no prior confirmation, warning comment/docstring, or explicit disclosure near the write itself beyond printing after completion.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

This code includes user-facing error text in Chinese, and similar Chinese-only messages appear throughout the script. For a general-purpose helper script, forcing a specific language without user opt-in can violate language/locale policy expectations.

Content

No source excerpt is available for this finding.