Back to skill

Security audit

Shopee 电商图片生成与编辑

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches Shopee image generation, but it can route the user's AI Hive API key to an unverified custom endpoint, so users should review it before installing.

Install only if you trust the publisher and AI Hive. Keep the base URL set to the official AI Hive endpoint, avoid untrusted --base-url or AI_HIVE_BASE_URL overrides, protect ~/.ai-hive/config.json, and consider using a virtual environment with pinned dependencies.

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

Bearer API Key Can Be Transmitted to an Arbitrary Caller-Controlled Endpoint

Content
View full analysis

Vulnerability Details

File Location: scripts/imagegen.py:90-99, scripts/imagegen.py:130-143, and scripts/imagegen.py:587
Vulnerability Type: Unrestricted API endpoint configuration leading to credential disclosure
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 argument, the AI_HIVE_BASE_URL environment variable, or ~/.ai-hive/config.json. The value is used without validating its scheme or hostname.

The HTTP client then attaches the user's AI Hive bearer credential to every request made through _request(). Consequently, an attacker-controlled base URL receives the Authorization header. The implementation also permits an http:// URL, which could expose the credential to network interception.

This is a credential-routing vulnerability: an authentication token intended for the official service is not bound to the trusted service ...[truncated 1054 chars]

Remediation
View remediation

Remediation Suggestions

  1. Require https:// for all authenticated API endpoints and reject plaintext HTTP.
  2. Allowlist the official AI Hive hostname for normal operation.
  3. If custom endpoints are necessary, require an explicit opt-in option and display a prominent warning before sending credentials.
  4. Bind credentials to origins: do not attach the production API key when the request hostname differs from the approved hostname.
  5. Parse URLs with a standard URL parser and reject credentials in URLs, unsupported schemes, malformed hosts, and ambiguous hostname representations.
  6. Treat environment and configuration-file endpoint overrides as untrusted input.
  7. Consider using separate credentials specifically provisioned for approved custom endpoints.
  8. Add automated tests confirming that bearer credentials are never sent to unapproved hosts or over plaintext connections.

T08 · Insecure Dependencies

Note
Location
SKILL.md:68
Finding

Unpinned Third-Party Dependency Installation

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:68-72 and scripts/imagegen.py:7,19-22
Vulnerability Type: Unpinned dependency and non-reproducible installation
Risk Level: Low

Vulnerable code:

bash
pip3 install requests
python3 "$SKILL_PATH/scripts/imagegen.py" init --skill-name shopee-ecommerce-image-generation-editing
python3 "$SKILL_PATH/scripts/imagegen.py" task --task-id <taskId>
python
try:
    import requests
except ImportError:
    print("Missing dependency: requests. Run pip3 install requests", file=sys.stderr)
    sys.exit(1)

Technical Analysis

The documented installation command installs requests without a pinned version, lock file, package hash, or isolated environment. The selected package and transitive dependency versions can therefore change between installations.

Although requests is a legitimate package and no malicious dependency is embedded in the project, this installation pattern weakens supply-chain integrity and reproducibility. A compromised future release, compromised package-index response, or incompatible dependency update could introduce code that executes when the script imports or uses the package.

Attack Path

  1. A user follows the documented pip3 install requests instruction.
  2. The package installer resolves the currently available package and transitive dependency versions from its configured index.
  3. If the resolved package source or a future dependency release is compromised, malicious package code is installed.
  4. The user runs scripts/imagegen.py.
  5. Python imports the installed package, allowing malicious dependency code to execute with the privileges of the user running the Skill.

Impact Assessment

Exploitation depends on compromise of the dependency source or a resolved dependency release. If that occurs, code could execute with the local user's privileges and access data available to that user, in ...[truncated 249 chars]

Remediation
View remediation

Remediation Suggestions

  1. Add a reviewed dependency manifest with an explicit compatible version, such as requests==<reviewed-version>.
  2. Use a lock file to pin all transitive dependencies.
  3. Include cryptographic package hashes where supported, for example through a hash-locked requirements file.
  4. Document installation inside a dedicated virtual environment rather than the global Python environment.
  5. Use a trusted package index and avoid unreviewed mirror configuration.
  6. Establish a dependency-update process that includes vulnerability scanning, compatibility tests, and review before changing locked versions.
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 (10)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The declared purpose is narrowly scoped to Shopee image generation/editing, but the implementation reportedly supports unrelated and more sensitive behaviors such as generic chat, video generation, model enumeration, user/wallet retrieval, media upload, and browser-based API key setup with local credential storage. This mismatch is dangerous because it hides materially broader data access and execution pathways from reviewers and users, increasing the chance of credential theft, privacy leakage, or misuse of the skill outside its stated purpose.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The file is presented as a Shopee image-generation/editing skill, but the implementation is a broad generic AI client supporting chat, model discovery, account inspection, uploads, and video generation. This violates least privilege for skills and increases the attack surface: a caller expecting only image editing can be induced to perform unrelated network actions, expose account metadata, or access broader paid capabilities.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
95% confidence
Finding

Video generation with image, video, audio, and frame inputs materially exceeds the declared image-generation/editing scope and enables richer data ingress and egress than users or orchestrators may expect. This broader media pipeline increases misuse potential, including unauthorized upload of sensitive media, higher-cost task abuse, and circumvention of skill-level restrictions intended for static images only.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
87% confidence
Finding

The skill invokes a Python script with capabilities implying shell, filesystem, environment, and network access, but the manifest provides no explicit tool-scope constraints or permission boundaries. That makes the runtime trust model overly broad and can allow unintended file access, outbound requests, or secret exposure if the backing script behaves unexpectedly or is modified.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The top-level documentation explicitly describes the module as a generic AI capability tool, which conflicts with the narrow Shopee image-skill identity. This kind of capability/identity mismatch is dangerous because downstream systems may trust the metadata and grant access, while the code actually exposes broader functions than advertised.

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 instructions are written entirely in Chinese, and the script's CLI messages and prompts consistently assume Chinese as the interaction language. There is no indication that the skill is region-specific or that users may choose another language, which creates a language/locale policy concern.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

Exposing user-info and wallet/balance retrieval is outside the declared purpose of Shopee image generation and unnecessarily grants account introspection capability. In a skill ecosystem, this can leak sensitive account metadata or spending information and provides reconnaissance value to an attacker or a misused agent.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

A generic text chat endpoint is unrelated to the skill's stated image-editing purpose and expands the capability from a constrained media tool into a general-purpose LLM interface. That makes prompt abuse, policy bypass attempts, data exfiltration through chat, and unintended billable use more likely in contexts that trusted this skill to be narrowly scoped.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

This markdown file uses Chinese throughout its substantive entries, which can amount to a language/locale policy issue when the skill does not offer user opt-in or explain that it is intentionally region-specific. The file contains no indication that the Chinese-only presentation is optional or required for a documented compliance or regional reason.

Content

No source excerpt is available for this finding.

Vague Triggers

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

This markdown skill description appears to define when the skill should be used, but the activation language is broad and open-ended: 'Create and edit Shopee product listing images...' plus a long list of related tasks. It does not clearly bound when the skill should not activate or provide negative examples, which can increase unintended invocation overlap with other ecommerce or image-editing skills.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.