Back to skill

Security audit

电商详情页工作室|AI-HIVE

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent AI-HIVE ecommerce media workflow, but it needs review because it handles persistent API keys and local file downloads with weak endpoint and path validation.

Review this before installing. Use only the official AI-HIVE endpoint, avoid setting AI_HIVE_BASE_URL or --base-url unless you fully trust it, keep any API key low-privilege and revocable, and choose an output directory that cannot overwrite important files. Run billable generation only after checking the final prompt, routing mode, and uploaded media.

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

Bearer API key can be transmitted to an arbitrary or plaintext endpoint

Content
View full analysis

Vulnerability Details

File Location: scripts/imagegen.py:91-99, 130-143, 587; equivalent code exists in scripts/videogen.py:91-99, 130-143, 587
Vulnerability Type: Unvalidated credential destination
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

The API base URL can come from the --base-url argument, the AI_HIVE_BASE_URL environment variable, or the persistent configuration file. None of these sources is validated for an approved hostname or an HTTPS scheme.

The client subsequently adds the AI-HIVE bearer credential to every request made through _request. Consequently, an attacker who can influence one of the base URL configuration sources can redirect authenticated requests to a server under their control. A plaintext HTTP endpoint would also expose the credential to network interception.

The same implementation is duplicated in both image and video generation scripts.

Attack Path

...[truncated 1125 chars]

Remediation
View remediation

Remediation Suggestions

  1. Parse the base URL with urllib.parse.urlparse and reject all schemes except HTTPS.
  2. Allowlist ai-hive.iclip.cn as the credential-bearing destination by default.
  3. If custom endpoints are required for development, require an explicit high-friction option and a separate credential rather than silently honoring environment or configuration changes.
  4. Reject URLs containing embedded credentials, unexpected ports, fragments, or ambiguous hostname encodings.
  5. Disable redirects for authenticated requests or validate every redirect destination before forwarding authorization headers.
  6. Do not persist arbitrary custom base URLs alongside production API keys.
  7. Apply the same validation centrally to both imagegen.py and videogen.py to prevent implementation drift.
  8. Add tests covering HTTP URLs, attacker-controlled hosts, malformed URLs, cross-origin redirects, and approved production endpoints.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/imagegen.py:397
Finding

Remote task metadata can cause output-directory traversal and arbitrary file overwrite

Content
View full analysis

Vulnerability Details

File Location: scripts/imagegen.py:397-406; equivalent code exists in scripts/videogen.py:397-406
Vulnerability Type: Path traversal through an unsanitized remote filename component
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)

The destination is then 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

taskType is obtained from the remote task response and incorporated directly into a local filename. It is not restricted to a fixed set of task types and is not stripped of path separators or traversal components.

A malicious value such as ../../target can cause the resolved path to escape the configured output directory. A value beginning with an absolute path can also cause pathlib to disregard the intended parent directory. Because the destination is opened with wb, an existing writable file is truncated and replaced.

Exploitation requires control of, or compromise of, the API response. This condition can arise through a compromised AI service or in combination with the unvalidated custom base URL finding.

Attack Path

  1. The attacker controls the configured API endpoint or compromises the remote API response.
  2. The attacker returns a completed task containing a crafted taskType, such as ../../.config/application/settings.
  3. The response includes an attacker-controlled `resultUr ...[truncated 813 chars]
Remediation
View remediation

Remediation Suggestions

  1. Do not derive local filenames from remote taskType values. Map recognized remote task types to fixed local labels such as image and video.
  2. Remove path separators and allow only a conservative filename character set.
  3. Resolve both the output directory and candidate path, then verify that the candidate remains beneath the output directory using Path.relative_to.
  4. Reject absolute paths and any component equal to ...
  5. Create files using exclusive mode where appropriate, or request explicit confirmation before replacing an existing file.
  6. Generate unpredictable local filenames independently of server metadata.
  7. Validate that result downloads use HTTPS and, where possible, restrict them to approved object-storage hosts.
  8. Apply the corrected shared download implementation to both generation scripts.
  9. Add regression tests with ../, absolute paths, alternate separators, encoded traversal sequences, and symlink-based escape attempts.

T08 · Insecure Dependencies

Note
Location
SKILL.md:78
Finding

Third-party dependency is installed without version or integrity pinning

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:78; scripts/imagegen.py:8, 18-21; scripts/videogen.py:8, 18-21
Vulnerability Type: Unpinned third-party dependency
Risk Level: Low

Vulnerable Code

SKILL.md instructs users that the scripts require requests without defining an audited version or lock file:

markdown
The scripts default to `https://ai-hive.iclip.cn/api`; they require `requests`,
and local video processing requires `ffmpeg`.

Both generation scripts provide unconstrained installation guidance:

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

The module documentation likewise recommends:

python
Dependency: requests (pip3 install requests)

Technical Analysis

The project does not provide a version-constrained requirements file, lock file, or package hashes. Users following the installation instruction receive whichever requests release and transitive dependency versions the package index resolves at installation time.

This prevents reproducible dependency review. A future compromised, malicious, or behaviorally incompatible release could execute in the context of these scripts and access API credentials, uploaded files, downloaded files, and network traffic.

No evidence was found that the current requests package is malicious. The risk arises from unconstrained future resolution and absent integrity verification.

Attack Path

  1. A user runs one of the scripts without requests installed.
  2. The script instructs the user to execute an unconstrained pip3 install requests.
  3. The package installer resolves the latest available package and transitive dependencies rather than a previously audited set.
  4. If a resolved package version or package-index delivery path is compromised, its installation or runtime code executes unde ...[truncated 616 chars]
Remediation
View remediation

Remediation Suggestions

  1. Add a version-pinned dependency manifest, such as requirements.txt, generated from an audited environment.
  2. Include cryptographic hashes and require installation with pip install --require-hashes.
  3. Pin transitive dependencies through a lock file produced by a tool such as pip-tools.
  4. Document installation inside an isolated virtual environment.
  5. Use a trusted package index and configure index restrictions where deployment policy permits.
  6. Add automated dependency vulnerability and integrity scanning.
  7. Establish a controlled update process that reviews and tests dependency upgrades before changing the lock file.
  8. Pin or document a trusted distribution source and version for the external ffmpeg requirement as well.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • 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
Findings (18)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

Undeclared browser opening, interactive API-key setup, and generic AI-HIVE tooling create a gap between expected and actual behavior. That gap is dangerous in agent ecosystems because hidden interaction patterns can prompt users for secrets or invoke external actions that were never clearly disclosed in the skill's stated scope.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

Undeclared browser opening, interactive API-key setup, and generic AI-HIVE tooling create a gap between expected and actual behavior. That gap is dangerous in agent ecosystems because hidden interaction patterns can prompt users for secrets or invoke external actions that were never clearly disclosed in the skill's stated scope.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

Undeclared browser opening, interactive API-key setup, and generic AI-HIVE tooling create a gap between expected and actual behavior. That gap is dangerous in agent ecosystems because hidden interaction patterns can prompt users for secrets or invoke external actions that were never clearly disclosed in the skill's stated scope.

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 workflows involving environment variables, local files, shell commands, and network access but does not declare any explicit tool scope or permissions boundary. In an agent setting, that ambiguity can cause over-broad tool exposure, making it easier for the skill to trigger sensitive operations such as reading local files, using API keys from the environment, or making external requests without a clear least-privilege contract.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The activation conditions are broader than the core use case and include adjacent domains like advertising, short drama, and social media content. Over-broad triggers are not a direct exploit by themselves, but they increase the likelihood that the skill activates in contexts where users did not intend external generation, file handling, or network-backed operations, which can amplify risk when combined with undeclared capabilities.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The default prompt instructs the model to produce a production-ready Chinese workflow regardless of the user's language preference, which can override user intent and reduce transparency about what the agent is doing. In a security-sensitive workflow, forced language output can impair user review, consent, and detection of risky generated commands, especially if the user expected another language.

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 without any visible trigger constraints, which can cause the agent to auto-select this skill in broader e-commerce or marketing conversations than the user intended. Because this skill is designed to generate runnable workflows and AI-HIVE commands, unintended activation could lead to unrequested content generation, external API usage, or actions based on incomplete authorization context.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This code embeds Chinese-only natural-language identifiers in the module docstring and argument parser description, which creates a locale-specific constraint without any user opt-in or documented justification. Under the policy, forcing a specific language is a natural-language policy violation unless the skill offers a language choice or clearly states a justified regional scope.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The file is presented and documented as a generic AI utility supporting chat, image, video, model listing, upload, and polling, while the declared skill is narrowly framed as an ecommerce detail-page image studio. This scope mismatch increases the attack surface and makes it easier for downstream callers to invoke unintended capabilities that bypass product-level restrictions or review assumptions.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The top-level docstring and all user-facing guidance are written in Chinese, presenting the skill as a general-purpose tool rather than a region-specific or Chinese-only skill. There is no indication that users may choose another language or that the locale restriction is required, which conflicts with the policy against forcing a specific language without opt-in.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

Video generation is a materially broader capability than a detail-page image studio and can be used for ad creative, avatar, or promotional media generation outside the advertised scope. In a skill ecosystem, hidden extra media-generation capabilities can undermine least-privilege expectations and enable misuse if orchestration or policy layers assume the skill only handles still-image ecommerce assets.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The file is a broad AI-Hive API client that supports chat, model listing, uploads, image generation, video generation, task polling, and account queries, while the declared skill is narrowly scoped to ecommerce detail-page studio work. This scope mismatch increases attack surface and permits capability abuse outside the advertised workflow, which can lead to unauthorized content generation or data handling not expected by users or platform reviewers.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The module self-describes as a generic AI capability tool, which contradicts the specialized ecommerce-detail-page skill metadata. This kind of misrepresentation is dangerous because it can bypass trust assumptions, review expectations, and user consent boundaries by embedding broader capabilities than the skill declaration suggests.

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 user-facing descriptions present the skill as a Chinese-language tool only, and nearly all CLI prompts/help text are fixed in Chinese. For an all-file-types policy check, this is a natural-language locale constraint that does not provide opt-in or alternative language selection.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

The top-level docstring says this is a '通用 AI 能力调用工具' wrapping generic chat, image, video, model query, media upload, and polling capabilities. Later, the file is configured and executed as the specialized skill 'ecommerce-detail-page-studio-ai-hive', so the documentation actively frames the file as a general-purpose client rather than the constrained ecommerce detail-page skill it is serving as.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
75% confidence
Finding

The manifest describes a workflow that takes product facts and evidence to produce detail-page artifacts, with AI-HIVE used mainly for material-generation operations such as configuration lookup, uploads, routing, polling, and download. A generic free-form chat endpoint capable of arbitrary multimodal conversation is broader than that narrowly described production workflow.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

Exposing user-info and wallet balance retrieval is unrelated to the stated ecommerce-detail-page purpose and unnecessarily broadens access to account metadata. Even if intended for diagnostics, it enables information disclosure about the connected account and billing state that a content-design skill does not need.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The skill interface exposes an arbitrary media upload command, allowing users to upload files independent of a constrained ecommerce detail-page workflow. This expands the skill into a general file-ingestion utility, increasing the chance of misuse, unexpected data handling, and policy circumvention through unsupported content types or unrelated assets.

Content

No source excerpt is available for this finding.