Back to skill

Security audit

电商内容智能路由|AI-HIVE

Security checks for vulnerabilities and agentic risk

Overview

This skill is mostly a coherent AI-HIVE content-generation helper, but it needs review because it handles API keys and media transfers with weak endpoint validation and broader capabilities than its router description suggests.

Review before installing. Use only the default AI-HIVE endpoint, avoid setting AI_HIVE_BASE_URL or --base-url unless you fully trust the destination, prefer environment-provided API keys over command-line keys, keep generated downloads in a bounded directory, and confirm costs and media rights before running generation commands.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (3)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/imagegen.py:91
Finding

API Credential Disclosure Through an Unrestricted Base URL

Content
View full analysis

Vulnerability Details

File Location: scripts/imagegen.py:91-100, 128-143, 528-530; duplicated in scripts/videogen.py:91-100, 128-143, 528-530
Vulnerability Type: CWE-200 — Exposure of Sensitive Information to an Unauthorized Actor
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
        )
python
def add_common_args(parser):
    parser.add_argument("--api-key", help="AI Hive API Key (sk-api-*)")
    parser.add_argument("--base-url", help=f"API Base URL (default {DEFAULT_BASE_URL})")
    parser.add_argument("--verbose", action="store_true", help="Detailed logging")

Technical Analysis

The client accepts an API base URL from a command-line argument, the AI_HIVE_BASE_URL environment variable, or the persistent configuration file. It does not validate the URL scheme or restrict the destination to an approved AI-HIVE host.

The same client unconditionally attaches the AI-HIVE bearer credential to every request sent through this base URL. Consequently, a maliciously supplied base URL can redirect credential-bearing API t ...[truncated 1368 chars]

Remediation
View remediation

Remediation Suggestions

  • Require HTTPS and reject URLs containing credentials, unexpected ports, fragments, or ambiguous host representations.
  • Restrict credential-bearing requests to an explicit allowlist of approved AI-HIVE hostnames.
  • If custom endpoints are required for development, require a conspicuous opt-in and a separate credential that is never an AI-HIVE production key.
  • Construct requests through a dedicated session whose authentication is scoped to the approved origin.
  • Disable redirects for authenticated API requests, or validate the scheme and destination of every redirect before following it.
  • Refuse to forward the Authorization header across origins.
  • Protect the configuration file and validate its ownership in addition to setting mode 0600.
  • Prefer environment-based secret injection over --api-key, because command-line arguments may be exposed through process listings and shell history.
  • Add tests confirming that HTTP URLs, unapproved hosts, cross-origin redirects, loopback addresses, and private-network destinations are rejected.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/imagegen.py:235
Finding

Unvalidated Server-Provided Upload and Download Destinations

Content
View full analysis

Vulnerability Details

File Location: scripts/imagegen.py:235-246, 269-278, 352-372; duplicated in scripts/videogen.py:235-246, 269-278, 352-372
Vulnerability Type: CWE-918 — Server-Side Request Forgery; CWE-400 — Uncontrolled Resource Consumption
Risk Level: Medium

Vulnerable Code:

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

# Upload 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,
        )
python
def download_file(url, out_path, timeout=300):
    """Stream a file download while displaying 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
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)

# Last frame
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)

Tec

...[truncated 2384 chars]

Remediation
View remediation

Remediation Suggestions

  • Allow only https:// upload and download URLs on explicitly approved object-storage or CDN domains.
  • Resolve destination hostnames and reject loopback, private, link-local, multicast, reserved, and cloud metadata addresses for both IPv4 and IPv6.
  • Protect against DNS rebinding by verifying the actual connected address or using trusted, fixed storage endpoints.
  • Restrict upload methods to the methods explicitly required by the protocol, preferably PUT.
  • Permit only a narrowly defined set of upload headers and reject authorization, proxy, host, forwarding, and other sensitive headers.
  • Disable redirects, or revalidate every redirect target before following it.
  • Enforce maximum upload and download sizes based on reviewed model limits.
  • Stop streaming as soon as the configured byte limit is exceeded, regardless of the declared Content-Length.
  • Download to a temporary file using exclusive creation, validate the media type and signature, and atomically rename the file only after successful validation.
  • Delete partial files after failures and report download failure through a nonzero exit status.
  • Apply equivalent controls to both resultUrl and lastFrameUrl.

T08 · Insecure Dependencies

Note
Location
scripts/imagegen.py:7
Finding

Unpinned Third-Party Dependency Installation

Content
View full analysis

Vulnerability Details

File Location: scripts/imagegen.py:7, 18-22; scripts/videogen.py:7, 18-22; installation guidance in SKILL.md:63
Vulnerability Type: CWE-1104 — Use of Unmaintained Third-Party Components / Supply-Chain Risk
Risk Level: Low

Vulnerable Code:

python
"""
Dependencies: requests (pip3 install requests)
"""
python
try:
    import requests
except ImportError:
    print("Missing dependency: requests. Run pip3 install requests", file=sys.stderr)
    sys.exit(1)

The project documentation similarly instructs users to install requests without specifying an approved version or integrity hash.

Technical Analysis

The project relies on the third-party requests package but does not include a version-constrained dependency manifest, lockfile, or package hashes. The suggested pip3 install requests command resolves whatever version and transitive dependencies are available from the active package index at installation time.

This makes installations non-reproducible and leaves dependency integrity dependent on the user's index and package-manager configuration. The code does not itself install or execute a suspicious package, and requests is correctly spelled; therefore, this is a hardening and supply-chain weakness rather than evidence of an intentionally malicious dependency.

Attack Path

  1. A user follows the documented installation command in an environment configured to use a compromised or untrusted Python package index.
  2. The index serves a malicious or compromised release of requests or one of its transitive dependencies.
  3. Pip installs package-controlled build or runtime content without verification against project-approved hashes.
  4. The package executes with the user's privileges during installation or when either generation script imports it.

Exploitation requires compromise or malicious configuration of the dependency-distribution p ...[truncated 416 chars]

Remediation
View remediation

Remediation Suggestions

  • Add a reviewed dependency manifest and lock requests and its transitive dependencies to tested versions.
  • Include cryptographic hashes and install with pip install --require-hashes -r requirements.txt.
  • Use a trusted, authenticated package index and explicitly configure the expected index URL.
  • Install dependencies in an isolated virtual environment under a nonprivileged account.
  • Add automated dependency vulnerability and provenance scanning to the release process.
  • Periodically update the lockfile through a controlled review process rather than accepting arbitrary latest releases at installation time.
  • Document the supported Python and dependency versions.
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • 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 (18)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

Presenting the skill as an orchestration/router while the exposed behavior is primarily generic media generation can mislead operators into using it for decisions or workflows it does not actually control. That creates security and operational risk because safeguards implied by the routing narrative—such as classification, cost controls, and task tracking—may not exist when users rely on them.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

Presenting the skill as an orchestration/router while the exposed behavior is primarily generic media generation can mislead operators into using it for decisions or workflows it does not actually control. That creates security and operational risk because safeguards implied by the routing narrative—such as classification, cost controls, and task tracking—may not exist when users rely on them.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

Presenting the skill as an orchestration/router while the exposed behavior is primarily generic media generation can mislead operators into using it for decisions or workflows it does not actually control. That creates security and operational risk because safeguards implied by the routing narrative—such as classification, cost controls, and task tracking—may not exist when users rely on them.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill advertises executable examples and capabilities that imply environment-variable access, file I/O, network access, and shell execution, but it declares no explicit tool scope or permission boundaries. In an agent setting, this can lead to over-broad tool invocation, accidental exposure of local files or secrets, and network actions that exceed user expectations.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The trigger phrase '内容自动化' is so broad that the skill may activate for many unrelated content tasks, causing over-selection of a skill with networked generation and possible billed operations. Over-broad routing is a security concern because it increases the chance that users are funneled into an overpowered workflow without clear need or informed consent.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

The activation condition around turning a reference case into 'original content' is ambiguous and can be interpreted to support close imitation of third-party works. In the context of a media-generation skill, unclear scope boundaries can facilitate copyright infringement, brand impersonation, or unauthorized derivative content generation.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The default prompt and implicit invocation combine to activate the skill on a wide range of loosely related requests, with no clear requirement for explicit user consent or bounded scope. In a skill that can generate runnable AI-HIVE commands and production-ready workflows, this can cause unintended routing, overreach into operational tasks, or execution-oriented output when the user only wanted general advice.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

Forcing Chinese output without checking user preference can mislead users, reduce reviewability, and increase the chance that important operational or policy details are misunderstood. In a workflow-generating skill for ecommerce automation, language mismatch can hide risky instructions or make human oversight less effective, especially in multilingual teams.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The module docstring and user-facing CLI/help text throughout the file are written in Chinese, which effectively forces a specific language for interaction. The file does not indicate that the skill is region-specific or provide any user opt-in or alternative locale, which matches the language/locale policy violation criteria.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The file includes broader capabilities than the skill advertises, including user-info access, text chat, video generation, and raw task handling. In a skill ecosystem, this expands the available attack surface and can enable misuse of the user's API key and account context for unintended billable operations or access to account metadata, especially if the host executes this script outside the intended narrow interface.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The manifest describes a skill that receives ecommerce content requirements and returns routing decisions such as demand classification, workflow choice, model mode, cost priority, and task queueing. In this file, the skill-specific entrypoint instead exposes only image generation, task polling, API-key initialization, and media upload against a fixed AI-HIVE image model, without implementing requirement intake or routing-analysis outputs.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The embedded SKILL_CONFIG markets '电商内容智能路由' and the manifest emphasizes multi-model scheduling with COST_FIRST/SPEED_FIRST/SUCCESS_FIRST path selection. However, skill_generate unconditionally forwards requests to a single configured model (public_model_nano_banana_pro) and simply passes through the caller's routing flag, so no actual model selection or scheduling logic is performed.

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 router that accepts business constraints and returns demand classification, workflow choice, model mode, cost priority, and task queue decisions for ecommerce content operations. This file instead exposes generic low-level OpenAPI operations for chat, image generation, video generation, uploads, task polling, and downloads, with only minimal mode/model selection logic near the end; it does not implement the promised routing/planning outputs.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The top-level docstring says this is a '通用 AI 能力调用工具' that wraps chat, image, video, model query, upload, and polling abilities. That active description conflicts with the skill manifest's narrow positioning as an ecommerce content router with specific routing and compliance-oriented usage boundaries.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This code file contains user-facing natural language that is entirely Chinese, including the top-level description and operational guidance. Because the skill does not offer a language/locale opt-in or alternative despite being a general-purpose tool, it effectively forces a specific language on users.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The manifest centers on ecommerce content routing and generated asset workflows, especially via AI-HIVE for content production. This file also supports generic text chat, user-info retrieval, and raw model enumeration, which are broader platform client capabilities not clearly justified by the declared specialized routing skill.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
61% confidence
Finding

Natural-language policy findings apply to all file types when a skill imposes language or locale behavior without user opt-in. Here, '语言' is listed as a required channel parameter, but the document does not state that the user may choose their preferred language or that defaults are optional.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

This code hardcodes Chinese-language skill names and descriptions in user-facing strings, including the module docstring and argparse description. Because the file provides no option to select language or indicate that the skill is intentionally region-specific, it may violate the language/locale policy requirement.

Content

No source excerpt is available for this finding.