Back to skill

Security audit

Temu 电商图片生成与编辑

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches Temu image generation, but it handles API credentials in a way that can send them to an arbitrary configured API server.

Review this before installing if you will store an AI Hive API key locally. Use only the default trusted AI Hive endpoint, avoid `--base-url` and `AI_HIVE_BASE_URL` unless you control the server, and consider rotating the key if it was ever used with an untrusted endpoint. Pin dependencies in your own environment if reproducibility matters.

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

Warning
Location
scripts/imagegen.py:92
Finding

API Credential Disclosure Through an Unrestricted Custom API Origin

Content
View full analysis

Vulnerability Details

File Location: scripts/imagegen.py:92-99, scripts/imagegen.py:133-143, and scripts/imagegen.py:587
Vulnerability Type: Credential disclosure through user-controlled API endpoint
Risk Level: Medium

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 be supplied through the --base-url command-line argument, the AI_HIVE_BASE_URL environment variable, or the local configuration file. No scheme validation, hostname allowlist, or credential-origin binding is performed.

Independently, the client creates a global request header containing the resolved API key:

http
Authorization: Bearer <API_KEY>

This header is attached to every API request regardless of the selected destination. Consequently, changing the API base URL to an attacker-controlled server causes the application to transmit the user's saved AI Hive API key to that server.

HTTPS is not required, ...[truncated 1938 chars]

Remediation
View remediation

Remediation Suggestions

  1. Restrict credential-bearing requests to an explicit allowlist of trusted HTTPS origins:

    python
    from urllib.parse import urlparse
    
    TRUSTED_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 TRUSTED_API_HOSTS:
            raise SystemExit("The API base URL is not trusted")
        if parsed.username or parsed.password:
            raise SystemExit("Credentials in the API URL are not permitted")
        return value.rstrip("/")
    
  2. Bind stored credentials to their intended origin. Do not load the default AI Hive key when a non-default endpoint is selected.

  3. If custom API servers are a required feature, require the user to provide a separate credential explicitly for that server. Display a clear confirmation identifying the destination before sending it.

  4. Reject plaintext HTTP endpoints whenever an authorization header or other sensitive data will be transmitted.

  5. Disable redirects for credential-bearing requests, or validate every redirect destination before following it. This prevents a trusted endpoint from redirecting an authenticated request to an untrusted origin.

  6. Add automated tests confirming that the authorization header is never sent to an unapproved hostname.

T08 · Insecure Dependencies

Note
Location
SKILL.md:79
Finding

Unpinned Third-Party Dependency Installation

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:79
Vulnerability Type: Mutable and unverified dependency resolution
Risk Level: Low

Vulnerable Code

bash
pip3 install requests

Technical Analysis

The documented installation command installs requests without a version constraint, lock file, or package hash. As a result, the installed code is selected from the package index at installation time rather than from an audited, reproducible dependency set.

Although requests is a legitimate package and the audited project does not contain a typosquatted package name, the unconstrained command leaves future installations exposed to mutable upstream state. A compromised release, compromised package-index account, incompatible future version, or untrusted package-index configuration could cause unexpected code to be installed and imported by scripts/imagegen.py.

Python package installation may execute package build logic, and imported dependencies execute with the privileges of the user running the skill.

Attack Path

  1. A user follows the installation instructions in SKILL.md.
  2. pip3 resolves requests and its transitive dependencies using the currently configured package index.
  3. The resolver selects whatever versions satisfy the unconstrained request at that time.
  4. If the selected package release or configured index has been compromised, malicious package or build code executes during installation or subsequent import.
  5. The malicious dependency operates with the privileges of the user running pip3 or the skill.

Exploitation depends on compromise or substitution within the dependency-distribution path; the audit found no evidence that the current requests package itself is malicious.

Impact Assessment

If the dependency supply chain is compromised, injected code could run with the invoking user's privileges. Depending on those privileges, this could expose:

  • The ...[truncated 443 chars]
Remediation
View remediation

Remediation Suggestions

  1. Declare dependencies in a version-controlled requirements or lock file rather than using an unconstrained installation command.

  2. Pin an audited version and verify package artifacts with hashes, for example:

    text
    requests==<audited-version> --hash=sha256:<verified-hash>
    
  3. Include and pin all relevant transitive dependencies, preferably using a locking tool such as pip-compile.

  4. Install with hash enforcement:

    bash
    python3 -m pip install --require-hashes -r requirements.txt
    
  5. Use an explicitly trusted package index or an internally controlled package mirror.

  6. Regularly review and intentionally update pinned dependencies after security testing rather than resolving arbitrary new versions during installation.

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

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The manifest is centered on creating and editing Temu product images and related graphics, but the code implements full video generation with image/video/audio inputs and frame controls. Video synthesis is a distinct capability that goes beyond the declared image-editing purpose.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding

The skill invokes a Python script and advertises capabilities that imply shell, file, environment, and network access, but it does not declare any explicit tool scope or permission boundaries. In an agent environment, that omission can cause overbroad execution privileges, increasing the risk of unintended file access, network exfiltration, or unsafe command execution if the skill or its inputs are abused.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The top-level docstring says this is a "通用 AI 能力调用工具" wrapping text chat, image generation, video generation, model queries, media upload, and task polling. That documented behavior is substantially broader than the manifest's Temu ecommerce image-generation/editing scope, indicating the underlying code is a repurposed generic client rather than a purpose-limited skill.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The module docstring actively characterizes the file as a generic AI Hive tool for chat, image, video, model query, upload, and polling operations. That directly conflicts with the surrounding skill packaging and manifest, which present the file as a Temu-focused image generation/editing skill.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file-level docstring and all user-facing CLI guidance are written in Chinese, presenting the skill as a general-purpose tool rather than a region-specific or Chinese-only skill. Because there is no opt-in, fallback, or justification for this locale restriction, the natural-language behavior violates the language/locale policy criteria.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

chat_text and its CLI wiring provide a standalone multimodal chat interface, which is not an obvious requirement for generating/editing Temu submission images, galleries, or package graphics. This adds an AI interaction surface beyond the skill's declared ecommerce image-production role.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The manifest describes a focused Temu product-image creation/editing skill, but the file exposes task, upload, and especially user-info and models functionality that queries account data and enumerates platform models. Those generic OpenAPI inspection capabilities are broader than creating/editing ecommerce images and are not necessary to fulfill the stated Temu-specific purpose.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

This markdown file contains user-facing natural language only in Chinese across the substantive changelog entries. Under the policy, forcing a specific language without user opt-in can be a locale-policy violation, and no alternative language or opt-in is provided here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The description mixes Chinese and explicitly targets multiple markets, including 'US, Germany and Japan', as a built-in behavior of the skill. This can be read as imposing locale-specific output expectations without stating that the user may choose language/locale preferences or that the scope is limited to a justified region-specific workflow.

Content

No source excerpt is available for this finding.