Back to skill

Security audit

AI电商运营总控|AI-HIVE

Security checks for vulnerabilities and agentic risk

Overview

This skill is mostly a disclosed AI-HIVE e-commerce media workflow tool, but it handles API keys and downloads with weak scoping that could expose credentials or write files outside the expected folder if redirected.

Review this skill before installing if you will use a real AI-HIVE account. Use a dedicated low-privilege API key, monitor billing, avoid setting --base-url or AI_HIVE_BASE_URL unless you fully trust the endpoint, keep generated outputs in a non-sensitive folder, and review parameters before any paid batch generation.

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:118
Finding

Bearer Credential Disclosure Through an Unrestricted API Base URL

Content
View full analysis

Vulnerability Details

File Location: scripts/imagegen.py:118-144, 587 and scripts/videogen.py:118-144, 587
Vulnerability Type: Server-side credential disclosure caused by an unrestricted endpoint override
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
parser.add_argument("--base-url", help=f"API Base URL (default {DEFAULT_BASE_URL})")

Technical Analysis

Both generation scripts permit the API origin to be supplied through the --base-url argument, the AI_HIVE_BASE_URL environment variable, or the local configuration file. The selected value is not restricted to the official AI-HIVE host, is not required to use HTTPS, and is not checked for embedded credentials or an unexpected port.

Every request made through AiHiveClient._request() automatically receives the AI-HIVE API key in an Authorization: Bearer header. Consequently, changing the base URL redirects authenticated requests—and the bearer credential itself—to an attacker-controlled endpoint.

The vulnerable behavior affects all authenticate ...[truncated 1302 chars]

Remediation
View remediation

Remediation Suggestions

  1. Allow only the official HTTPS API origin during normal operation:
    python
    from urllib.parse import urlparse
    
    ALLOWED_API_HOSTS = {"ai-hive.iclip.cn"}
    
    def validate_base_url(value):
        parsed = urlparse(value)
        if parsed.scheme != "https":
            raise SystemExit("The API base URL must use HTTPS")
        if parsed.hostname not in ALLOWED_API_HOSTS:
            raise SystemExit("Unapproved API host")
        if parsed.username or parsed.password:
            raise SystemExit("Embedded URL credentials are prohibited")
        return value.rstrip("/")
    
  2. Remove --base-url from production-facing commands unless custom endpoints are genuinely required.
  3. If development endpoints are necessary, require an explicit unsafe-development option and a separate non-production credential.
  4. Do not attach an authorization header until the final request URL has passed scheme, hostname, and port validation.
  5. Ignore or reject untrusted base_url values loaded from the configuration file.
  6. Apply the same correction to both scripts/imagegen.py and scripts/videogen.py.
  7. Rotate any API key that may already have been used with an untrusted base URL.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/imagegen.py:398
Finding

Path Traversal Through API-Controlled Download Filenames

Content
View full analysis

Vulnerability Details

File Location: scripts/imagegen.py:398-413 and scripts/videogen.py:398-413
Vulnerability Type: Path traversal and placement or overwrite of remotely supplied content
Risk Level: Medium

Vulnerable Code

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)

The destination is subsequently opened for replacement:

python
with open(str(out_path), "wb") as f:
    for chunk in resp.iter_content(chunk_size=8192):
        if chunk:
            f.write(chunk)

Technical Analysis

The output filename incorporates taskType from the remote task response and taskId associated with the remote generation response. Neither identifier is restricted to a safe filename character set.

Python's pathlib discards the preceding directory when the right-hand operand is absolute. Directory separators and traversal components can also influence path resolution. A malicious API can therefore make the computed destination escape the intended output directory. The selected destination is then opened using wb, which truncates an existing file before writing downloaded bytes.

Exploitability is particularly relevant because the same scripts allow the API server to be replaced through --base-url, an environment variable, or configuration. Compromise of the legitimate API or interception through an unsaf ...[truncated 1183 chars]

Remediation
View remediation

Remediation Suggestions

  1. Do not use remotely supplied task properties as filesystem path components.
  2. Generate local names from trusted constants and locally generated identifiers.
  3. If remote identifiers must be retained, restrict them to a conservative character set:
    python
    import re
    
    def safe_identifier(value):
        value = str(value)
        if not re.fullmatch(r"[A-Za-z0-9_-]{1,100}", value):
            raise SystemExit("Unsafe task identifier")
        return value
    
  4. Resolve and verify every destination before opening it:
    python
    base = Path(output_dir).expanduser().resolve()
    destination = (base / filename).resolve()
    if destination.parent != base:
        raise SystemExit("Download path escapes the output directory")
    
  5. Reject absolute path components and all values containing /, \, .., null bytes, or platform-specific separators.
  6. Use exclusive file creation (xb) or require explicit confirmation before replacing an existing file.
  7. Apply the correction to ordinary result files and last-frame files in both generation scripts.

T08 · Insecure Dependencies

Note
Location
scripts/imagegen.py:18
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, and SKILL.md:78
Vulnerability Type: Uncontrolled third-party dependency version
Risk Level: Low

Vulnerable Code

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

The documented installation command is effectively:

bash
pip3 install requests

Technical Analysis

The project directs users to install requests without a pinned version, lockfile, integrity hash, isolated environment requirement, or explicitly trusted package index. Although the package name is not an apparent typosquat, installation is not reproducible and implicitly trusts whichever package index and latest compatible release are selected by the user's environment.

An unpinned dependency can change after the Skill has been reviewed. A compromised upstream release, compromised package index, malicious index configured in the user's environment, or incompatible future release could introduce code that executes during installation or import.

No evidence was found that the current project intentionally references a malicious package. This finding concerns the unsafe dependency acquisition process.

Attack Path

  1. A user runs the Skill without requests installed.
  2. The error message or documentation instructs the user to execute pip3 install requests.
  3. The user's package manager resolves an unspecified version from its configured index.
  4. A compromised source or future malicious release supplies altered package content.
  5. Package installation hooks or imported package code execute with the privileges of the user performing the installation or running the Skill.

Impact Assessment

Successful supply-chain compromise could execute code with the privileges of the user who installs or impor ...[truncated 387 chars]

Remediation
View remediation

Remediation Suggestions

  1. Declare a reviewed and pinned dependency version in a requirements file or project manifest.
  2. Generate and commit a lockfile containing cryptographic hashes.
  3. Install dependencies with hash enforcement, for example:
    bash
    python3 -m pip install --require-hashes -r requirements.txt
    
  4. Require installation inside a dedicated virtual environment rather than the system interpreter.
  5. Document the trusted package index and avoid inheriting unreviewed extra indexes.
  6. Add automated dependency scanning and scheduled update review.
  7. Apply the same dependency guidance to both generation scripts and SKILL.md.
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 (17)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The skill claims business-input handling and routing to image/video/copy skills, but those controls are not substantiated in the provided content, while other generic capabilities are implied. In the context of a commerce skill that may process proprietary SKU, inventory, pricing, or campaign data, this ambiguity raises risk because data could be routed or exposed in ways users did not reasonably expect.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The skill claims business-input handling and routing to image/video/copy skills, but those controls are not substantiated in the provided content, while other generic capabilities are implied. In the context of a commerce skill that may process proprietary SKU, inventory, pricing, or campaign data, this ambiguity raises risk because data could be routed or exposed in ways users did not reasonably expect.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The skill claims business-input handling and routing to image/video/copy skills, but those controls are not substantiated in the provided content, while other generic capabilities are implied. In the context of a commerce skill that may process proprietary SKU, inventory, pricing, or campaign data, this ambiguity raises risk because data could be routed or exposed in ways users did not reasonably expect.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding

The skill advertises executable examples that use environment variables, local files, network access, and shell commands, but it does not declare any tool scope or permission boundaries. In an agent environment, undeclared capabilities reduce transparency and can enable broader-than-expected access to secrets, filesystem data, or external endpoints when the skill is invoked.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The trigger conditions are very broad, covering common topics like e-commerce, content marketing, product images, and videos. Overbroad triggers can cause the skill to activate in unrelated conversations, increasing the chance that users are steered into external services, paid generation flows, or unnecessary data collection without clear intent.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest describes an orchestration/planning skill, but the default prompt expands it into producing 'runnable AI-HIVE commands' and 'production-ready' workflow/code. That scope expansion can cause the agent to generate executable actions beyond the narrowly described role, increasing the chance of unsafe automation, over-privileged use, or execution-oriented prompt injection pathways.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The prompt explicitly instructs the skill to produce a 'production-ready Chinese workflow', which imposes a language choice regardless of user preference. This is a natural-language policy concern because the file does not offer any language selection or document a justified region-specific constraint.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Implicit invocation allows this skill to trigger without tightly defined conditions, which can cause the agent to route unrelated or partially related requests into an e-commerce automation workflow. In a skill that can produce operational plans and AI-HIVE commands, broad auto-invocation raises the risk of unintended actions, prompt-scope confusion, and misuse in contexts the user did not explicitly authorize.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The file’s natural-language descriptions, setup instructions, status messages, and CLI help are written exclusively in Chinese, which effectively imposes a specific language on users. Under the policy, language constraints should either provide user opt-in/choice or be clearly justified as region-specific; this file does neither.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The manifest focuses on generating and orchestrating e-commerce creative assets through AI-HIVE, but this code also implements an interactive credential-bootstrap workflow: it opens a browser, prompts the user to paste an API key, and stores it in a local config file. Credential management may be convenient operationally, but it is not a direct content-generation capability justified by the business purpose stated in the manifest.

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 this skill as an AI e-commerce copilot that routes to concrete image/video/copy generation, while this file is packaged as an image skill. However, the exposed subcommands include generic task status inspection and upload of arbitrary files/media IDs, which are broader infrastructure operations rather than the claimed business-facing image-generation behavior. This is more than an implementation detail because these commands provide standalone API utility capabilities outside the user-facing intent described for the skill.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file materially diverges from the declared skill purpose: instead of an e-commerce operations copilot, it exposes a general AI-Hive media-generation CLI. This capability mismatch weakens least-privilege and trust boundaries, because a caller expecting narrowly scoped commerce orchestration may unknowingly grant access to broad model invocation, media upload, and content generation workflows outside the documented use case.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The top-level docstring and all user-facing guidance are written exclusively in Chinese, presenting the skill as a general-purpose tool rather than a clearly China-specific or Chinese-only skill. Under the policy, forcing a specific language without user opt-in or justification is a natural-language locale violation.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The code exposes unrelated high-scope functions such as generic text chat, model enumeration, and user/account inspection beyond the stated e-commerce/video purpose. In an agent skill setting, these hidden extra capabilities can be abused to probe account state, invoke unintended models, or route arbitrary content through the API under the user's credentials.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

This Python file includes user-facing natural-language strings primarily in Chinese, including the module docstring, CLI description, skill name, and search aliases. Under the policy rule for language or locale constraints, this appears to impose a specific language experience without any explicit user choice or documented justification.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

At the top of the file, the documentation says this is a generic AI Hive tool covering text chat, image generation, video generation, model query, media upload, and polling. But the actual packaged entrypoint and embedded skill configuration present this file as a specific e-commerce image skill with generate, task, upload, and init commands. This is an active documentation-to-code intent mismatch, not merely omitted detail.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
85% confidence
Finding

The top-level docstring explicitly describes the file as a generic AI-Hive capability invocation tool covering chat, image, video, model query, upload, and polling. However, the built skill metadata and manifest present a specialized AI e-commerce copilot/video-generation skill, so the inline documentation describes a materially broader intent than the actual packaged skill identity.

Content

No source excerpt is available for this finding.