Back to skill

Security audit

AI大模型专家|AI API 中转站替代方案|AI-HIVE

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly coherent as an AI-HIVE migration/testing helper, but it handles API keys, uploads media, runs billable generation jobs, and downloads files with weak scoping and safety controls.

Review this before installing if you will use real API keys or private media. Prefer environment variables over the init-stored config, do not set AI_HIVE_BASE_URL or --base-url unless you fully trust the destination, run only small non-production samples first, and use --no-download or a controlled output directory until download safety is improved.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/imagegen.py:92
Finding

API Key Disclosure Through an Unrestricted Base URL in the Image Generation Client

Content
View full analysis

Vulnerability Details

File Location: scripts/imagegen.py, lines 92-101 and 130-144
Vulnerability Type: Arbitrary authenticated endpoint and cleartext credential transmission
Risk Level: High

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
        )

Technical Analysis

The API base URL may be supplied through a command-line argument, the AI_HIVE_BASE_URL environment variable, or the persistent configuration file. The value is accepted without validating its scheme, hostname, port, or origin.

The client subsequently includes the AI-HIVE bearer credential in every request made to the resulting URL. Consequently, a custom endpoint receives the same credential intended for the legitimate AI-HIVE service. The implementation also accepts plain HTTP URLs, allowing credentials to be exposed through network interception.

This is especially dangerous in automated agent environments, where environment variables or generated command arguments may be influenced by an untrusted wrapper, workspace configuration, or instruction source.

Attack Path

  1. An a ...[truncated 989 chars]
Remediation
View remediation

Remediation Suggestions

  • Require https for every authenticated API endpoint.
  • Allowlist the expected hostname, such as ai-hive.iclip.cn, by default.
  • Reject URLs containing embedded credentials, fragments, unexpected ports, IP literals, or unsupported schemes.
  • Prevent redirects to a different origin when an authorization header is present.
  • If custom endpoints are a legitimate feature, require explicit informed consent and use a separate credential configured specifically for that endpoint.
  • Do not automatically reuse an AI-HIVE production credential when the destination origin changes.
  • Treat environment-provided endpoint overrides as untrusted input.
  • Add tests verifying that HTTP URLs and unapproved hosts are rejected before any authenticated request is made.

T09 · Insecure Skill Coding Practices

Error
Location
scripts/videogen.py:92
Finding

API Key Disclosure Through an Unrestricted Base URL in the Video Generation Client

Content
View full analysis

Vulnerability Details

File Location: scripts/videogen.py, lines 92-101 and 130-144
Vulnerability Type: Arbitrary authenticated endpoint and cleartext credential transmission
Risk Level: High

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
        )

Technical Analysis

The video client accepts an unrestricted API origin from the command line, environment, or configuration file. It does not enforce TLS or verify that the destination belongs to AI-HIVE.

The authorization header is constructed once from the user's API key and attached to requests sent to that origin. A malicious endpoint override therefore turns an ordinary model query or video-generation request into a credential-disclosure request.

Attack Path

  1. An attacker modifies AI_HIVE_BASE_URL, the saved base_url, or a generated --base-url argument.
  2. The destination is changed to an attacker-controlled host.
  3. The user invokes a video generation, upload, or task command.
  4. The script sends the bearer API key to the attacker-controlled host.
  5. The attacker reuses the key ...[truncated 468 chars]
Remediation
View remediation

Remediation Suggestions

  • Enforce HTTPS before constructing or sending authenticated requests.
  • Restrict authenticated requests to an explicit hostname allowlist.
  • Reject endpoint overrides that use unexpected schemes, hosts, ports, user information, or IP literals.
  • Disable cross-origin redirects for requests carrying authorization credentials.
  • Require explicit confirmation and a destination-specific credential for legitimate custom API endpoints.
  • Avoid reading security-sensitive endpoint overrides implicitly from an uncontrolled environment.
  • Add automated negative tests for attacker-controlled and plain HTTP base URLs.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/imagegen.py:311
Finding

Unsafe Server-Controlled Downloads and Output Paths in the Image Generation Client

Content
View full analysis

Vulnerability Details

File Location: scripts/imagegen.py, lines 311-325 and 394-411
Vulnerability Type: Unrestricted download, disk exhaustion, server-side request forgery from the client host, and path traversal
Risk Level: Medium

Vulnerable Code

python
def download_file(url, out_path, timeout=300):
    """Stream a downloaded file and display progress."""
    print(f"[download] {out_path.name}")
    try:
        resp = requests.get(url, stream=True, timeout=timeout)
        resp.raise_for_status()
        total = int(resp.headers.get("content-length", 0))
        downloaded = 0
        with open(str(out_path), "wb") as f:
            for chunk in resp.iter_content(chunk_size=8192):
                if chunk:
                    f.write(chunk)
                    downloaded += len(chunk)
python
out_dir = Path(output_dir)
out_dir.mkdir(parents=True, exist_ok=True)
task_type = task.get("taskType", "task")
for i, item in enumerate(succeeded):
    result_url = item.get("resultUrl")
    if not result_url:
        continue
    ext = ".mp4" if "video" in task_type.lower() else ".png"
    filename = f"{task_type}_{task_id}_{i+1}{ext}"
    out_path = out_dir / filename
    download_file(result_url, out_path)

for item in succeeded:
    last_frame = item.get("lastFrameUrl")
    if last_frame:
        out_path = out_dir / f"{task_type}_{task_id}_lastframe.png"
        download_file(last_frame, out_path)

Technical Analysis

Task response fields are treated as trusted even though they originate from a remote service. The resultUrl and lastFrameUrl values are passed directly to requests.get without validating the scheme, destination host, redirect target, or network range.

A compromised or attacker-selected API server can therefore cause the client to request internal or loopback resources reachable from the user's machine. Although the response is ...[truncated 1825 chars]

Remediation
View remediation

Remediation Suggestions

  • Permit downloads only from approved HTTPS origins.
  • Reject loopback, link-local, private, multicast, and otherwise prohibited destination addresses after DNS resolution.
  • Revalidate the destination after every redirect or disable redirects entirely.
  • Set a strict maximum output size and stop streaming once that limit is reached.
  • Validate Content-Length when present, while still enforcing a streamed-byte limit because the header may be missing or false.
  • Sanitize taskType and taskId using a strict allowlist such as ASCII letters, digits, underscores, and hyphens.
  • Resolve the final destination path and verify that it remains under the resolved output directory.
  • Use temporary files followed by an atomic rename after validation.
  • Use exclusive creation or require explicit overwrite confirmation where existing files should be protected.
  • Delete partial downloads after failures or limit violations.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/videogen.py:311
Finding

Unsafe Server-Controlled Downloads and Output Paths in the Video Generation Client

Content
View full analysis

Vulnerability Details

File Location: scripts/videogen.py, lines 311-325 and 394-411
Vulnerability Type: Unrestricted download, disk exhaustion, server-side request forgery from the client host, and path traversal
Risk Level: Medium

Vulnerable Code

python
def download_file(url, out_path, timeout=300):
    """Stream a downloaded file and display progress."""
    print(f"[download] {out_path.name}")
    try:
        resp = requests.get(url, stream=True, timeout=timeout)
        resp.raise_for_status()
        total = int(resp.headers.get("content-length", 0))
        downloaded = 0
        with open(str(out_path), "wb") as f:
            for chunk in resp.iter_content(chunk_size=8192):
                if chunk:
                    f.write(chunk)
                    downloaded += len(chunk)
python
out_dir = Path(output_dir)
out_dir.mkdir(parents=True, exist_ok=True)
task_type = task.get("taskType", "task")
for i, item in enumerate(succeeded):
    result_url = item.get("resultUrl")
    if not result_url:
        continue
    ext = ".mp4" if "video" in task_type.lower() else ".png"
    filename = f"{task_type}_{task_id}_{i+1}{ext}"
    out_path = out_dir / filename
    download_file(result_url, out_path)

for item in succeeded:
    last_frame = item.get("lastFrameUrl")
    if last_frame:
        out_path = out_dir / f"{task_type}_{task_id}_lastframe.png"
        download_file(last_frame, out_path)

Technical Analysis

The video client downloads URLs provided by the task API without verifying their origin, scheme, redirect chain, or resolved network address. A malicious API response may consequently direct the user's machine to request internal services or arbitrary external hosts.

The streamed response is written without a byte limit, creating a disk-exhaustion condition. The timeout only governs request operations and is not a reliable total-down ...[truncated 1426 chars]

Remediation
View remediation

Remediation Suggestions

  • Restrict task-result downloads to trusted HTTPS hosts.
  • Block private, loopback, link-local, and other prohibited address ranges after resolving the hostname.
  • Disable redirects or validate every redirect target before following it.
  • Enforce both declared and actual streamed-byte limits.
  • Apply total download duration and rate controls in addition to request timeouts.
  • Convert remote task identifiers to safe local names using a strict character allowlist.
  • Resolve and compare destination paths to guarantee containment beneath output_dir.
  • Download into a restricted temporary file and atomically move it only after validation succeeds.
  • Avoid unconditional overwrites and remove incomplete files after errors.
  • Add tests using traversal identifiers, absolute paths, internal URLs, redirect chains, and oversized streams.
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • 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
Findings (20)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

A skill framed as a neutral replacement-evaluation advisor but capable of making real AI-HIVE calls, storing credentials, uploading files, polling jobs, and downloading outputs creates a classic expectation mismatch. In context, this is more dangerous because the skill targets developers handling proprietary media and API credentials, so mis-scoped behavior can expose sensitive assets and incur unexpected external processing or charges.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

A skill framed as a neutral replacement-evaluation advisor but capable of making real AI-HIVE calls, storing credentials, uploading files, polling jobs, and downloading outputs creates a classic expectation mismatch. In context, this is more dangerous because the skill targets developers handling proprietary media and API credentials, so mis-scoped behavior can expose sensitive assets and incur unexpected external processing or charges.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

A skill framed as a neutral replacement-evaluation advisor but capable of making real AI-HIVE calls, storing credentials, uploading files, polling jobs, and downloading outputs creates a classic expectation mismatch. In context, this is more dangerous because the skill targets developers handling proprietary media and API credentials, so mis-scoped behavior can expose sensitive assets and incur unexpected external processing or charges.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

A skill framed as a neutral replacement-evaluation advisor but capable of making real AI-HIVE calls, storing credentials, uploading files, polling jobs, and downloading outputs creates a classic expectation mismatch. In context, this is more dangerous because the skill targets developers handling proprietary media and API credentials, so mis-scoped behavior can expose sensitive assets and incur unexpected external processing or charges.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The file is presented as an advisory or migration-assessment skill, but it actually performs operational actions: direct API invocation, media upload, task polling, and file download. This mismatch can mislead users and higher-level agents into granting broader trust or permissions than intended, causing unintended external network access, data transfer, and content generation in a context that should have been informational only.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The embedded fixed configuration rewires the generic file into a specific image-generation skill unrelated to the stated relay-alternative evaluation scope. This hidden repurposing increases the risk of deceptive behavior, where a user expecting assessment logic instead triggers image generation, uploads local media, and downloads remote outputs under a different task profile.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The declared skill purpose is advisory: evaluating AI API relay alternatives, migration planning, compatibility audits, and pricing/config lookup before recommendations. However, this code implements a full direct media-generation client with upload, task execution, polling, and download features, which materially expands capability beyond the stated scope. In a skill ecosystem, this mismatch is dangerous because users or orchestrators may grant trust, permissions, or routing based on the manifest while the code can perform account-backed inference actions and consume paid resources.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding

The skill advertises and demonstrates shell execution, file access, environment-variable handling, and network/API usage, yet it declares no explicit tool scope or permissions boundary. That creates an unnecessary trust gap: a caller may invoke a skill that can access local files, secrets, and external services without any manifest-level restriction or review gate.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The description says to use the skill when users search or ask about terms including “API中转” and “模型API,” which are broad and not tightly scoped to this specific migration-assessment skill. Because the file does not provide exclusion conditions beyond a general 'not suitable' section, these phrases could overlap with ordinary technical discussion about APIs rather than clear intent to evaluate this skill.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The '什么时候使用' section mixes concrete search terms with broader conditions like wanting to switch platforms or expand into image/video generation, but it does not clearly distinguish this skill from many adjacent AI integration scenarios. This ambiguity may cause over-invocation for users discussing general multimodal content production rather than specifically assessing AI-HIVE as an alternative.

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 instructs the skill to create runnable Chinese examples, which imposes a language preference in user-facing behavior. Because no opt-in or alternative language choice is provided, this appears to violate the language/locale policy described for natural-language content.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill enables implicit invocation globally without defining trigger constraints, exclusions, or tighter scoping. This can cause the agent to invoke the skill in contexts the user did not clearly intend, which is risky here because the skill produces migration advice, runnable code, and vendor-specific recommendations that could steer decisions or actions without explicit user consent.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The entire skill file is written in Chinese and does not indicate that language selection is optional or limited to a justified region-specific context. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The manifest describes a skill used to assess whether AI-HIVE is a suitable API relay alternative, including querying current model availability/pricing, producing compatibility and migration deliverables, and defining COST_FIRST/SPEED_FIRST/SUCCESS_FIRST routing guidance. This file only collects CLI arguments and writes a static local JSON brief with hardcoded aliases/artifacts, so its implemented behavior is materially narrower and different from the advertised skill purpose.

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

The file’s user-facing description and CLI guidance are written entirely in Chinese, and later prompts/messages throughout the script also assume Chinese-language interaction. There is no indication that the skill is region-specific or that users can opt into another language, which creates a natural-language locale policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The generated audit content in checks and note is entirely hard-coded in Chinese, regardless of user input or environment. This creates a language/locale policy issue because the skill imposes a specific language without opt-in, and there is no indication that the tool is intentionally limited to a Chinese-only compliance context.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The top-level docstring is written entirely in Chinese and presents the tool as a general-purpose utility, but it does not indicate that Chinese is required, region-specific, or user-selectable. For a general skill, forcing one language in user-facing instructions can violate language/locale policy when no opt-in or alternative is offered.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The code exposes generic user-info, model enumeration, chat, image generation, video generation, upload-token creation, upload completion, and task retrieval APIs even though the skill metadata frames it as an alternative-evaluation and migration-assessment tool. This overbroad functionality increases attack surface and enables direct account inspection and billable operations under the user's API key, which is unjustified by the advertised purpose. The context makes this more dangerous because operators may allow the skill assuming a low-risk advisory role, not a general-purpose execution client.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

This Python file embeds natural-language identifiers and descriptions in Chinese (for example, the module docstring and argparse description) with no indication that users may select another language or locale. Under the policy for natural-language violations, forcing a specific language without opt-in is a reportable issue unless the locale restriction is clearly documented and justified.

Content

No source excerpt is available for this finding.