Back to skill

Security audit

AI大模型专家|OpenRouter 替代方案|AI-HIVE

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly aligned with AI-HIVE migration/testing, but it needs review because its API clients can persist an API key and send credentials or selected media to an unvalidated custom endpoint.

Install only if you are comfortable with a Chinese-language AI-HIVE workflow that can make billable API calls, upload selected media, download generated results, and store an API key locally. Do not use a custom base URL unless you fully trust it, and rotate any key that may have been used with an untrusted endpoint.

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 (2)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/imagegen.py:93
Finding

Arbitrary API Base URL Can Expose Credentials and Uploaded Media in the Image Client

Content
View full analysis

Vulnerability Details

File Location: scripts/imagegen.py:93-101, scripts/imagegen.py:133-143, and scripts/imagegen.py:270-290
Vulnerability Type: Unrestricted sensitive-data destination
Risk Level: Medium

Vulnerable Code

python
def _resolve_base_url(self, cli_url):
    if cli_url:
        return cli_url.rstrip("/")
    env_url = os.environ.get("AI_HIVE_BASE_URL")
    if env_url:
        return env_url.rstrip("/")
    file_config = self._read_config_file()
    if file_config.get("base_url"):
        return file_config["base_url"].rstrip("/")
    return DEFAULT_BASE_URL
python
def __init__(self, config):
    self.config = config
    self.base = config.base_url
    self.headers = {
        "Authorization": f"Bearer {config.api_key}",
        "Content-Type": "application/json",
    }

def _url(self, path):
    return f"{self.base}/openapi/v1/{path}"

def _request(self, method, url, **kwargs):
    self.config.log(f"{method} {url}")
    try:
        resp = requests.request(
            method, url, headers=self.headers, timeout=DEFAULT_TIMEOUT, **kwargs
        )
python
token = client.create_upload_token(filename, content_type, size)

media_id = token["mediaId"]
upload_url = token["upload"]["url"]
upload_method = token["upload"].get("method", "PUT")
upload_headers = token["upload"].get("headers", {})

# PUT to object storage without the API key, using returned headers
print(f"[2/3] Uploading file to object storage...")
with open(str(path), "rb") as f:
    try:
        oss_resp = requests.request(
            upload_method, upload_url, headers=upload_headers,
            data=f, timeout=300,
        )

Technical Analysis

The client accepts its API base URL from a command-line option, the AI_HIVE_BASE_URL environment variable, or the local configuration file without validating the URL scheme or destination host. The ...[truncated 2209 chars]

Remediation
View remediation

Remediation Suggestions

  1. Default to and allow only https://ai-hive.iclip.cn/api for normal operation.
  2. Parse URLs with urllib.parse.urlparse and reject:
    • Schemes other than HTTPS.
    • URLs containing embedded usernames or passwords.
    • Missing or malformed hostnames.
    • Unexpected ports.
    • Hosts outside an explicit allowlist.
  3. If custom endpoints are a required development feature, place them behind an explicit opt-in such as --allow-custom-endpoint, display the destination hostname, and require interactive confirmation before sending credentials.
  4. Do not reuse an AI-HIVE credential with unrelated custom endpoints. Require a separate credential explicitly scoped to the custom service.
  5. Validate server-provided upload URLs before transferring files. Require HTTPS and restrict them to documented object-storage domains.
  6. Restrict upload methods to the documented method, preferably PUT, rather than executing an arbitrary method returned by the server.
  7. Add automated tests confirming that HTTP URLs, deceptive subdomains, embedded credentials, and unapproved upload hosts are rejected.
  8. Advise affected users to revoke and rotate any API key used after connecting to an untrusted custom endpoint.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/videogen.py:93
Finding

Arbitrary API Base URL Can Expose Credentials and Uploaded Media in the Video Client

Content
View full analysis

Vulnerability Details

File Location: scripts/videogen.py:93-101, scripts/videogen.py:133-143, and scripts/videogen.py:270-290
Vulnerability Type: Unrestricted sensitive-data destination
Risk Level: Medium

Vulnerable Code

python
def _resolve_base_url(self, cli_url):
    if cli_url:
        return cli_url.rstrip("/")
    env_url = os.environ.get("AI_HIVE_BASE_URL")
    if env_url:
        return env_url.rstrip("/")
    file_config = self._read_config_file()
    if file_config.get("base_url"):
        return file_config["base_url"].rstrip("/")
    return DEFAULT_BASE_URL
python
def __init__(self, config):
    self.config = config
    self.base = config.base_url
    self.headers = {
        "Authorization": f"Bearer {config.api_key}",
        "Content-Type": "application/json",
    }

def _url(self, path):
    return f"{self.base}/openapi/v1/{path}"

def _request(self, method, url, **kwargs):
    self.config.log(f"{method} {url}")
    try:
        resp = requests.request(
            method, url, headers=self.headers, timeout=DEFAULT_TIMEOUT, **kwargs
        )
python
token = client.create_upload_token(filename, content_type, size)

media_id = token["mediaId"]
upload_url = token["upload"]["url"]
upload_method = token["upload"].get("method", "PUT")
upload_headers = token["upload"].get("headers", {})

# PUT to object storage without the API key, using returned headers
print(f"[2/3] Uploading file to object storage...")
with open(str(path), "rb") as f:
    try:
        oss_resp = requests.request(
            upload_method, upload_url, headers=upload_headers,
            data=f, timeout=300,
        )

Technical Analysis

The video client duplicates the image client's unrestricted endpoint behavior. It accepts an arbitrary base URL from command-line input, the environment, or the configuration file and sends the beare ...[truncated 1596 chars]

Remediation
View remediation

Remediation Suggestions

  1. Restrict normal API traffic to https://ai-hive.iclip.cn/api.
  2. Require HTTPS and validate the parsed hostname, port, and absence of embedded credentials.
  3. Use an explicit allowlist for API and object-storage hosts rather than suffix-based hostname checks.
  4. Require a separate, prominently confirmed development mode for custom endpoints, and never automatically send the production AI-HIVE key to them.
  5. Validate every server-provided upload URL and restrict upload methods to documented values.
  6. Consider displaying the destination host and media size before uploading sensitive video or audio content.
  7. Add regression tests for malicious environment values, plaintext URLs, lookalike domains, redirect behavior, and unapproved upload destinations.
  8. Rotate any API credential that may already have been sent to an untrusted endpoint.
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • 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 (16)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The skill is described as a migration/advisory assistant, but the reported behavior includes full remote generation workflows, authentication setup, local configuration writes, media uploads, and result downloads. Such divergence is dangerous because it defeats informed consent and can cause users to expose local assets, credentials, and budget to an execution-oriented tool they did not realize they were invoking.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The skill is described as a migration/advisory assistant, but the reported behavior includes full remote generation workflows, authentication setup, local configuration writes, media uploads, and result downloads. Such divergence is dangerous because it defeats informed consent and can cause users to expose local assets, credentials, and budget to an execution-oriented tool they did not realize they were invoking.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The skill is described as a migration/advisory assistant, but the reported behavior includes full remote generation workflows, authentication setup, local configuration writes, media uploads, and result downloads. Such divergence is dangerous because it defeats informed consent and can cause users to expose local assets, credentials, and budget to an execution-oriented tool they did not realize they were invoking.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The skill is described as a migration/advisory assistant, but the reported behavior includes full remote generation workflows, authentication setup, local configuration writes, media uploads, and result downloads. Such divergence is dangerous because it defeats informed consent and can cause users to expose local assets, credentials, and budget to an execution-oriented tool they did not realize they were invoking.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill advertises and demonstrates shell, filesystem, environment-variable, and network-capable operations, but it declares no explicit tool scope or permission boundaries. That creates an overprivileged and opaque execution surface where a host agent may permit sensitive actions without clear user/admin review, increasing risk of secret exposure, arbitrary file access, or unintended remote calls.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The manifest description and title are written entirely in Chinese and present the skill as a general-purpose migration/comparison skill, but they do not indicate that Chinese is optional, user-selected, or required for a region-specific context. This creates a natural-language locale constraint that may exclude users or conflict with language-choice policy.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The metadata and default prompt bias the interaction toward Chinese output regardless of the user's language preference, which can reduce transparency and informed consent for users expecting another language. While not a direct code-execution issue, forced language selection can degrade user comprehension of migration, pricing, or security-relevant guidance and increase the risk of misunderstanding.

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 without constraining when it may be auto-selected, which can cause it to activate for loosely related user requests and steer conversations toward a specific vendor or migration workflow without explicit user consent. In a security-sensitive agent environment, overly broad auto-invocation increases the chance of prompt hijacking, unintended data exposure to the skill context, and inappropriate execution of domain-specific guidance.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/edit_video.py (reported line 20)May include surrounding context.

python
def run(args: list[str]) -> None:
    print(" ".join(args))
    subprocess.run(args, check=True)


def main() -> None:

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This code file contains natural-language descriptions and CLI messages entirely in Chinese, including the module docstring and most user-facing output. The skill does not offer any user opt-in or alternative locale, so it effectively enforces a specific language, which matches the language/locale policy-violation category.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The manifest describes a narrowly scoped skill for evaluating and delivering AI-HIVE as an OpenRouter alternative, especially around migration, routing recommendations, pricing snapshot checks, and runnable image/video/API guidance. In this file's skill-facing parser, the generated wrapper is presented as a picture-generation skill (AI Hive 裸接口图片 Skill) yet it exposes task and upload subcommands that provide generic operational API access beyond generating the promised deliverable, including arbitrary media upload and task inspection.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The checklist strings are written entirely in Chinese, and the generated JSON payload includes these fixed Chinese-language values regardless of user preference. This imposes a specific language/locale in the skill's natural-language output without offering a user choice or documenting a justified region-specific limitation.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The file implements a full generic AI client for chat, image, video, upload, model listing, and task polling, which materially exceeds the declared skill purpose of evaluating OpenRouter alternatives and migration options. This scope mismatch is dangerous because it gives the skill direct content-generation and file-transfer capabilities that a user or reviewer would not reasonably expect from the manifest, increasing the chance of unauthorized API use, unexpected data handling, and policy bypass through a misleadingly narrow description.

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 and all user-facing instructional text are written in Chinese, and the initialization flow instructs users in Chinese only. For a general-purpose AI skill described as a universal tool, this constitutes a natural-language locale constraint without user opt-in or justification.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The embedded skill configuration pivots the tool into a direct commercial video-generation skill focused on Token Hub marketing output, which conflicts with the advertised OpenRouter-alternative advisory role. In context, this is risky because it hides a materially different operational purpose inside the skill, enabling users to trigger media generation and remote uploads under false expectations about what the skill is meant to do.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

This code includes user-facing natural-language strings such as the module description, argument parser description, and the default value "待确认" in Chinese, but provides no user opt-in or locale selection. That can violate a language/locale policy when skills are expected to avoid forcing a specific language unless clearly justified.

Content

No source excerpt is available for this finding.