Back to skill

Security audit

1688 电商图片生成与编辑

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a disclosed AI image-generation helper, but its downloader can write API-supplied files outside the chosen output folder if the API endpoint is malicious or compromised.

Install only if you trust the AI Hive endpoint and are comfortable uploading reference images and storing an API key locally. Until the downloader sanitizes task metadata and verifies output-directory containment, avoid custom or untrusted `--base-url` values and use a low-risk output directory.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/imagegen.py:390
Finding

API-Controlled Path Traversal Allows Arbitrary File Overwrite

Content
View full analysis

Vulnerability Details

File Location: scripts/imagegen.py:390-408
Vulnerability Type: Path traversal and arbitrary file write
Risk Level: High

Vulnerable Code

python
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)

# Tail 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)

Technical Analysis

The local destination filename is constructed from task_type and task_id. These values originate from API responses and are not validated or normalized before being joined with the configured output directory.

Python's pathlib joining behavior does not guarantee containment beneath out_dir. A value containing parent-directory sequences such as ../../ can escape the intended directory. An absolute path component can also cause the preceding output directory to be discarded.

The resulting path is passed to download_file(), which opens the destination in binary write mode. Consequently, an attacker who controls or compromises the API response can select both the downloaded content and, through crafted path components, its destination.

Exploitation requires control over, or compromise of, the configured API service. That condition is plausible because the base URL can be changed through the --base-url argument, the AI_HIVE_BASE_URL environment variable, or the local configuration file.

Attack Path

  1. The victim invokes image generation while connected to a malicious or compromised API endpoint.
  2. The endpoint returns a craft ...[truncated 1254 chars]
Remediation
View remediation

Remediation Suggestions

  • Do not use remote response fields directly in local filenames. Generate destination names from trusted constants and locally generated identifiers.

  • Enforce a strict allowlist for identifiers, such as ASCII letters, digits, underscores, and hyphens.

  • Explicitly reject /, \, .., control characters, null bytes, and absolute path components.

  • Resolve and verify the final path before writing:

    python
    output_root = Path(output_dir).resolve()
    destination = (output_root / safe_filename).resolve()
    
    if output_root not in destination.parents:
        raise SystemExit("Unsafe output path")
    
  • Consider using Path.name only as a secondary defense; it should not replace strict input validation.

  • Avoid silently overwriting existing files. Use exclusive creation mode, generate collision-resistant local names, or require explicit overwrite confirmation.

  • Validate taskId immediately when received and validate taskType before any filesystem operation.

  • Restrict custom API endpoints to HTTPS and warn users before sending credentials or trusting file metadata from a non-default endpoint.

T08 · Insecure Dependencies

Warning
Location
SKILL.md:69
Finding

Unpinned Runtime Dependency Installation Creates Supply-Chain Exposure

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:69
Vulnerability Type: Unpinned third-party dependency installation
Risk Level: Medium

Vulnerable Code

bash
pip3 install requests

Technical Analysis

The documented installation command installs the latest version of requests and any transitive dependencies selected by the user's configured Python package index. It specifies neither an audited version nor cryptographic hashes.

As a result, installation is not reproducible: the resolved dependency set can change after the Skill has been reviewed. The command also inherits the user's package-index and mirror configuration, which may point to an untrusted or compromised source.

Although requests is a legitimate package and no typosquatted package name was identified, the mutable installation instruction creates unnecessary supply-chain risk. Python package installation may execute build backend or installation logic, making dependency integrity relevant to local code execution.

Attack Path

  1. The user follows the setup instructions and runs pip3 install requests.
  2. pip queries the currently configured package index or mirror.
  3. A compromised package release, dependency, mirror, index configuration, or network trust boundary supplies an unexpected artifact.
  4. The artifact is installed without verification against an audit-approved version and hash.
  5. Malicious installation or runtime code executes with the privileges of the user performing the installation or invoking the Skill.

Impact Assessment

Exploitation could execute arbitrary dependency code with the installing user's privileges. The resulting scope depends on how installation is performed:

  • In a virtual environment, access is generally limited to the invoking user's permissions and environment.
  • A user-level installation can affect other Python applications used by the same account.
  • A privileged or syste ...[truncated 255 chars]
Remediation
View remediation

Remediation Suggestions

  • Pin requests and all transitive dependencies to reviewed versions.

  • Store dependencies in a lock file generated from an audited environment.

  • Include cryptographic hashes and install with hash enforcement, for example:

    bash
    python3 -m pip install --require-hashes -r requirements.txt
    
  • Use an isolated virtual environment rather than modifying the system Python environment.

  • Document the expected package index and avoid silently inheriting unknown private mirrors.

  • Regularly review and update pinned dependencies through a controlled process that includes vulnerability scanning and regression testing.

  • Prefer distributing a verified dependency manifest over instructing users to install an unconstrained latest version.

Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • 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
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (10)

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

This markdown file's substantive content is entirely in Chinese, with no indication that the skill is region-specific or that users may choose another language. Under the stated policy, forcing a specific language or locale without opt-in is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding

The skill invokes shell commands, installs a package, and runs a Python script with network, file, and environment access, but it does not declare any tool restrictions or permissions. This creates an avoidable over-privilege situation where an agent may execute broader-capability actions than users expect, increasing the blast radius if the script or its inputs are abused.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The description and instructions explicitly position the skill for '1688' ecommerce imagery and are written entirely around a Chinese-language marketplace context, including the directive to use it for '1688电商图片' and related Chinese wholesale scenarios. There is no indication that users may choose another language or locale, nor any explicit justification that this locale restriction is mandatory policy rather than a default use case.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The file presents itself as a specialized 1688 ecommerce image skill, but actually bundles broad-purpose capabilities including chat, video generation, model enumeration, account info retrieval, and arbitrary media upload. This violates least-privilege and increases the attack surface: a caller or wrapper that trusts the skill metadata may unintentionally grant access to functions beyond the declared purpose.

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 its primary docstring and user-facing CLI/help text in Chinese, presenting the skill as a general-purpose tool rather than a region-specific or Chinese-only skill. Under the policy, forcing a specific language without user opt-in or a documented justification is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill includes a user-info capability that can retrieve account and wallet-related information despite not being necessary for ecommerce image generation. In a skill ecosystem, hidden access to account data creates unnecessary data exposure and can enable reconnaissance or privacy leakage if invoked by an agent or user who expects only image operations.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Embedding a general text-chat interface inside an image-generation skill introduces undeclared behavior and expands what prompts and data can be sent to the remote API. This mismatch makes the skill harder to reason about and can be abused as a covert general-purpose model access path when policy or review intended to allow only image editing.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

Video generation is unrelated to the stated 1688 image-editing purpose and meaningfully broadens the skill's remote-action surface, including additional media inputs and outputs. In context, this makes the skill more dangerous because reviewers and users may approve it for simple image work while it can perform higher-cost, broader-scope media operations.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

The string value for api_key includes Chinese text (请替换为你的APIKey), which imposes a specific language in user-facing configuration content. Under the policy, locale-specific language should either be optional or clearly justified; this file provides neither.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The top-level docstring states the program is a '通用 AI 能力调用工具' supporting text chat, image generation, video generation, model queries, media upload, and task polling. This directly conflicts with the skill's specialized manifest positioning as a 1688 ecommerce image generation/editing skill.

Content

No source excerpt is available for this finding.