Back to skill

Security audit

电商选品决策助手|AI-HIVE

Security checks for vulnerabilities and agentic risk

Overview

This skill is not clearly malicious, but it should be reviewed because it stores and uses an AI-HIVE API key for billable media-generation workflows with weak endpoint scoping.

Install only if you trust AI-HIVE and are comfortable with a persistent local API key, file uploads, downloads, and potentially billable generation tasks. Keep the default official endpoint, avoid setting AI_HIVE_BASE_URL or --base-url unless you fully trust that server, review final prompts and routing before submitting jobs, and do not upload media unless you have rights to use it.

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

Error
Location
scripts/imagegen.py:91
Finding

API Credential Disclosure Through an Unrestricted Custom Base URL

Content
View full analysis

Vulnerability Details

File Location: scripts/imagegen.py:91-99, 130-143; identical implementation in scripts/videogen.py:91-99, 130-143
Vulnerability Type: Unvalidated destination used for authenticated HTTP requests
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

Both generation clients accept the API base URL from a command-line argument, the AI_HIVE_BASE_URL environment variable, or the persistent configuration file. The value is used without validating its scheme, hostname, port, or resolved IP address.

The client constructs an Authorization: Bearer header containing the AI-HIVE API key and attaches it to every request sent to that base URL. Consequently, a modified environment or configuration can redirect an apparently legitimate command to an attacker-controlled server and disclose the credential. Plaintext HTTP is also accepted, allowing interception on an untrusted network.

Redirect behavior is not explicitly disabled or constrained. Although common HTTP libraries may remove authorization ...[truncated 1555 chars]

Remediation
View remediation

Remediation Suggestions

  1. Default to the fixed official endpoint and allow authenticated requests only to an explicit hostname allowlist, such as ai-hive.iclip.cn.
  2. Parse the URL with urllib.parse.urlparse and require:
    • The https scheme.
    • An approved hostname.
    • An expected port or the default HTTPS port.
    • No embedded username or password.
  3. Resolve the hostname and reject loopback, private, link-local, multicast, reserved, and unspecified IP addresses.
  4. Disable automatic redirects for authenticated requests or validate every redirect destination before following it.
  5. Never forward the AI-HIVE bearer credential to a destination whose origin differs from the approved API origin.
  6. If custom compatible endpoints are a required feature, use a separate endpoint-specific credential and require an explicit interactive warning or trust configuration.
  7. Treat the configuration file as security-sensitive. Verify ownership and reject symlinks or files not owned by the current user before reading credentials and endpoint settings.
  8. Consolidate the duplicated HTTP client into one reviewed module so fixes apply consistently to image and video workflows.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/imagegen.py:280
Finding

Server-Controlled Upload and Download URLs Enable SSRF

Content
View full analysis

Vulnerability Details

File Location: scripts/imagegen.py:280-300, 311-332, 401-408; identical implementation in scripts/videogen.py:280-300, 311-332, 401-408
Vulnerability Type: Server-Side Request Forgery through unvalidated response URLs
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", {})

# 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,
        )
    except requests.exceptions.RequestException as e:
        raise SystemExit(
            f"Object-storage upload network error: {e}\n"
            "Check the network connection or whether the file is too large"
        )
if not oss_resp.ok:
    try:
        detail = oss_resp.text
    except Exception:
        detail = "<unable to read response>"
    raise SystemExit(f"Object-storage upload failed ({oss_resp.status_code}): {detail}")

The original source uses Chinese status messages; the control flow above is preserved and translated for an English-only report.

python
def download_file(url, out_path, timeout=300):
    """Stream a file download 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 += le
...[truncated 4098 chars]
Remediation
View remediation

Remediation Suggestions

  1. Parse every upload, result, last-frame, and redirect URL before making a request.
  2. Require HTTPS and maintain an explicit allowlist of approved object-storage domains.
  3. Resolve destination hostnames and reject loopback, private, link-local, multicast, reserved, and unspecified addresses for both IPv4 and IPv6.
  4. Prevent DNS rebinding by validating the resolved address used by the actual connection, not only an earlier lookup.
  5. Disable redirects by default. If redirects are required, validate the scheme, hostname, port, and resolved address at every hop and impose a low redirect limit.
  6. Restrict upload methods to the exact documented set, preferably only PUT, rather than accepting an arbitrary server-provided method.
  7. Filter returned upload headers through an allowlist and reject sensitive or connection-altering headers.
  8. Enforce maximum upload and download sizes. Abort streaming when the limit is exceeded, including when Content-Length is missing or inaccurate.
  9. Download to a securely created temporary file and atomically rename it only after the response passes content-type and size validation.
  10. Verify that downloaded content matches the expected media type instead of selecting the extension solely from taskType.
  11. Apply the same controls in a shared HTTP utility used by both duplicated scripts.
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 (19)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The skill frames AI-HIVE usage as optional support for creative assets, yet the documented operational behavior appears to include broader API usage such as model/pricing queries, arbitrary media upload/download, and account-related access. Undeclared expansion into account and general API operations materially increases risk because it may expose financial/account metadata or enable unintended remote actions under the cover of a low-risk decision-support description.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The skill frames AI-HIVE usage as optional support for creative assets, yet the documented operational behavior appears to include broader API usage such as model/pricing queries, arbitrary media upload/download, and account-related access. Undeclared expansion into account and general API operations materially increases risk because it may expose financial/account metadata or enable unintended remote actions under the cover of a low-risk decision-support description.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The skill frames AI-HIVE usage as optional support for creative assets, yet the documented operational behavior appears to include broader API usage such as model/pricing queries, arbitrary media upload/download, and account-related access. Undeclared expansion into account and general API operations materially increases risk because it may expose financial/account metadata or enable unintended remote actions under the cover of a low-risk decision-support description.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The implemented skill exposes generic image generation, upload, task polling, and initialization flows, while the advertised skill purpose is a fact-based ecommerce product-selection decision assistant. This capability mismatch is dangerous because it expands the operational scope far beyond user expectations and policy framing, enabling content generation workflows that could be used for deceptive product marketing or unauthorized asset creation under the cover of a benign analytics skill.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The file advertises itself under an ecommerce product-selection skill context, but the implementation is a generic AI Hive client for chat, image, and video generation. This capability mismatch is dangerous because it expands the operational scope far beyond the declared purpose, enabling unrelated content generation workflows that users, reviewers, or policy controls may not expect or authorize.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

These functions expose broad media upload and video/image generation operations that are not necessary for an ecommerce selection assistant. In the context of a decision-support skill, hidden or unjustified generative-media features increase the risk of policy evasion, unauthorized content production, and misuse under the cover of a benign business-analysis tool.

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 rely on environment variables, filesystem access, shell execution, and networked API calls, but it declares no explicit tool scope or permission boundaries. That creates an overprivileged integration surface where a host agent may enable more capabilities than users expect, increasing the chance of secret exposure, arbitrary file access, or unintended external requests.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The manifest centers the skill on receiving product, cost, margin, inventory, audience, and other user-provided facts to deliver scoring, risk, content difficulty, and validation plans. However, the file expands the skill into content production by promising scripts, image/video tasks, AI-HIVE generation, and task submission workflows, which goes beyond a product-selection decision assistant into a creative asset generation tool.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger conditions are broad enough to capture general marketing, content, and adaptation requests well beyond narrow ecommerce product selection. Overbroad invocation criteria are dangerous because they can cause this skill to activate in contexts where stronger review, different policies, or more specialized skills should apply, especially given its documented networked and potentially billable media-generation flows.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The natural-language prompt explicitly requires a "production-ready Chinese workflow," which imposes a specific language choice regardless of user preference. This is a language policy concern because the file does not offer an opt-in, alternative locale, or region-specific justification for mandating Chinese.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
80% confidence
Finding

The docstring frames the file as producing a production brief for the 电商选品决策助手, implying output aligned with product-selection decision support. However, the actual JSON fields and artifacts focus on generic business goal decomposition, content strategy, and media tasks, which contradict the assistant's documented decision-support intent.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The file’s natural-language description, argument parser description, skill name, and search aliases are all hard-coded in Chinese, with no option for the user to choose another language or locale. This can violate a language/locale policy when skills must not force a specific language without explicit user opt-in or documented regional justification.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The manifest describes a skill focused on e-commerce product selection decisions using user-provided facts, producing scoring tables, risks, content difficulty, and validation plans. This script instead generates a 'production brief' with content-strategy and image/video task artifacts, which expands the behavior into content-production planning rather than product-selection analysis.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The module header and CLI description present the file as a general-purpose AI capability caller, which contradicts the specialized ecommerce-selection identity in the skill metadata. This inconsistency is security-relevant because users, reviewers, and orchestrators may grant the skill broader trust based on its declared narrow purpose while the code actually provides broader generative capabilities.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The module docstring and subsequent user-facing messages are written entirely in Chinese, and the CLI does not indicate any option to select another language. For a general-purpose skill, this creates a natural-language locale constraint without user opt-in or justification.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The skill metadata says decisions must be based only on provided facts and must not impersonate real-time market data, yet the code adds a direct image synthesis path that is not necessary for scoring or SKU analysis. In this context, image synthesis increases abuse potential because it can be used to fabricate commercial-looking product assets or misleading promotional material adjacent to a trust-framed decision-support tool.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The module docstring and all user-facing guidance are written exclusively in Chinese, and the CLI help and prompts throughout the file continue that assumption. This creates a language/locale constraint without any visible opt-in or documented justification, which matches the policy-violation category for forced language choice.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The embedded configuration claims the skill is for ecommerce product-selection decisions, but the CLI parser and runtime present a video-generation interface with generate/task/upload commands. This deceptive or inconsistent presentation undermines reviewability and user trust, and can cause operators to invoke a materially different capability than the approved skill description suggests.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

The core description emphasizes a bounded decision assistant that uses supplied facts to produce a scorecard, risks, content difficulty, and validation plan. Elsewhere, the file promises business-goal decomposition, content strategy, platform versions, conversion acceptance tables, executable scripts, prompts, and code commands, which broadens the behavior beyond the narrower analytic scope described in the manifest.

Content

No source excerpt is available for this finding.