Back to skill

Security audit

淘宝 电商图片生成与编辑

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches its image-generation purpose, but its API endpoint can be redirected without validation, which could expose the user’s API key and product images if configuration or environment values are tampered with.

Review this skill before installing if you will use real commercial product images or paid API credentials. Use a dedicated AI Hive API key, avoid setting custom base URLs unless you fully trust the endpoint, check ~/.ai-hive/config.json for unexpected changes, and prefer installing dependencies in an isolated environment.

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

API Credentials and User Media Can Be Redirected to an Attacker-Controlled Server

Content
View full analysis

Vulnerability Details

File Location: scripts/imagegen.py:74-81, scripts/imagegen.py:116-129, scripts/imagegen.py:276-285, and scripts/imagegen.py:555-557
Vulnerability Type: Unrestricted API endpoint override and insufficient destination validation
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 _request(self, method, url, **kwargs):
    self.config.log(f"{method} {url}")
    try:
        resp = requests.request(
            method, url, headers=self.headers, timeout=DEFAULT_TIMEOUT, **kwargs
        )
    except requests.exceptions.ConnectionError as e:
        raise SystemExit(
            f"Unable to connect to API server: {url}\n"
            f"Reason: {e}"
        )

The authorization header used by this request is constructed as follows:

python
self.headers = {
    "Authorization": f"Bearer {config.api_key}",
    "Content-Type": "application/json",
}

The upload destination is accepted from the API response:

python
media_id = token["mediaId"]
upload_url = token["upload"]["url"]
upload_method = token["upload"].get("method", "PUT")
upload_headers = token["upload"].get("headers", {})

with open(str(path), "rb") as f:
    try:
        oss_resp = requests.request(
            upload_method, upload_url, headers=upload_headers,
            data=f, timeout=300,
        )

The alternate API endpoint is exposed through a command-line option:

python
parser.add_argument("--api-key", help="AI Hive API Key (sk-api-*)")
parser.add_argum
...[truncated 2652 chars]
Remediation
View remediation

Remediation Suggestions

  1. Allow only the expected production origin, such as https://ai-hive.iclip.cn/api, during normal Skill execution.
  2. If custom endpoints are required for development, place them behind an explicit option such as --allow-unsafe-custom-endpoint and display a clear warning before transmitting credentials.
  3. Parse endpoints with urllib.parse.urlparse and require:
    • The https scheme.
    • A nonempty hostname.
    • No embedded username or password.
    • An allowlisted hostname and port.
  4. Do not honor endpoint-related environment variables in production Skill mode unless this behavior is explicitly required and documented.
  5. Validate media upload and result download URLs independently. Require HTTPS and restrict destinations to approved object-storage domains.
  6. Consider using separate request sessions for authenticated API calls and unauthenticated storage transfers to prevent accidental authorization-header propagation.
  7. If an untrusted endpoint has previously been configured, revoke and rotate the affected API key and review usage records for unauthorized activity.

T08 · Insecure Dependencies

Note
Location
SKILL.md:85
Finding

Third-Party Dependency Is Installed Without Version or Integrity Pinning

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:85
Vulnerability Type: Unpinned third-party dependency
Risk Level: Low

Vulnerable Code

bash
pip3 install requests

The script imports the package directly at runtime:

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

Technical Analysis

The installation instruction retrieves requests without a fixed version, lockfile, package hash, or isolated environment. The package name is legitimate, and the reviewed project does not specify a malicious registry or similarly named package. However, dependency resolution is not reproducible and automatically trusts whichever compatible release and transitive dependencies are supplied by the configured package index at installation time.

This creates supply-chain exposure if a future package release, maintainer account, package index, dependency, or local package-index configuration is compromised. It may also introduce unexpected compatibility or security changes without review.

Attack Path

  1. A user follows the documented pip3 install requests instruction.
  2. pip queries the user's configured package index and resolves the latest applicable package and transitive dependencies.
  3. A compromised index, package release, maintainer account, or dependency supplies malicious or altered content.
  4. The package is installed and later imported by scripts/imagegen.py.
  5. Malicious package code executes with the privileges of the user running the installation or Skill.

This is a supply-chain risk rather than evidence that the current requests package is malicious.

Impact Assessment

If the dependency supply chain were compromised, malicious package code could execute with the invoking user's privileges. Depending on that user's permissions, this could expose local files ...[truncated 281 chars]

Remediation
View remediation

Remediation Suggestions

  1. Add a reviewed dependency manifest with an exact version, for example:

    text
    requests==<reviewed-version>
    
  2. Generate and verify cryptographic package hashes, then install with:

    bash
    pip install --require-hashes -r requirements.txt
    
  3. Lock transitive dependencies rather than pinning only the direct dependency.

  4. Recommend installation inside a dedicated virtual environment instead of the user's global Python environment.

  5. Use a trusted package index and avoid inheriting unreviewed index or mirror settings.

  6. Establish a controlled dependency-update process that includes security review and automated vulnerability scanning.

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

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

This markdown file contains user-facing natural-language content exclusively in Chinese across the substantive changelog entries. Under the language/locale policy, forcing a specific language without user opt-in or an explicit justified regional scope is a policy concern.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
96% confidence
Finding

The skill invokes shell commands, installs packages, reads images from disk, and communicates with an external service, but it does not declare any explicit tool or permission scope. That creates an avoidable trust gap: an agent may grant broader filesystem, network, environment, or shell access than is actually needed, increasing the blast radius if the skill is misused or later modified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The manifest description and main heading/instructions are written in Chinese and direct the user into a Chinese-language workflow, while also hard-coding product/platform context for 淘宝/天猫. There is no indication that users may choose another language or locale, which can violate language/locale policy when the skill is used in broader contexts.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The module is implemented as a general-purpose AI Hive client rather than a narrowly scoped Taobao/Tmall image skill. This creates unnecessary capability exposure: a caller who can invoke the script can access unrelated text, video, model-listing, upload, and account operations, increasing the blast radius if the skill is misused or integrated into an agent that assumes narrow permissions.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The documentation explicitly frames the file as a general AI capability tool, which conflicts with the narrower Taobao ecommerce image-skill identity. This mismatch is dangerous because reviewers, orchestrators, or policy systems may trust the manifest's limited scope while the implementation actually supports broader operations.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The module docstring and user-facing CLI messaging are written entirely in Chinese, and the skill does not indicate any option to select another language or locale. This creates a natural-language policy concern because the skill effectively imposes a specific language on all users without explicit opt-in or documented regional justification.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Exposing user-info and wallet-balance retrieval is unrelated to ecommerce image generation and unnecessarily grants access to account metadata. In an agent environment, this can leak sensitive billing or identity information to prompts, logs, or downstream consumers that were only supposed to edit images.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The generic chat endpoint allows arbitrary text-model use, which is outside the stated purpose of a Taobao image-generation/editing skill. That broadens the skill into a general LLM proxy and can be abused for unrelated actions, prompt exfiltration, policy bypass attempts, or cost-incurring usage that the caller did not intend to authorize.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

Video generation is materially broader than the declared image-generation/editing scope and introduces additional upload, processing, storage, and cost surface area. In agent use, an ostensibly image-only skill could be repurposed to create arbitrary videos from user-supplied media, violating least privilege and surprising operators.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The example API key value uses Chinese placeholder text ('请替换为你的APIKey'), which imposes a specific language in user-facing configuration content. The file does not offer a language choice or explain a region-specific need for Chinese-only text.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

Model enumeration is not inherently dangerous, but it exposes platform capability discovery beyond what a fixed-purpose skill needs. This can aid misuse by letting callers probe available models and routing options, increasing the chance of the skill being used as a generic API exploration tool.

Content

No source excerpt is available for this finding.