Back to skill

Security audit

AI大模型专家|淘宝 电商图片生成与编辑

Security checks for vulnerabilities and agentic risk

Overview

The skill is broadly aligned with AI-HIVE image generation, but it needs review because it can send an API key to a configurable API endpoint and may invoke networked paid generation workflows too broadly.

Install only if you intend to use AI-HIVE for e-commerce image generation and are comfortable storing an AI-HIVE API key locally. Do not set --base-url or AI_HIVE_BASE_URL to any untrusted host, and review requests that upload files or submit batch jobs because they may transfer product images to AI-HIVE and consume account quota.

Vulnerability Patterns
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/imagegen.py:97
Finding

Caller-Controlled API Base URL Can Exfiltrate the Bearer API Key

Content
View full analysis

Vulnerability Details

File Location: scripts/imagegen.py, lines 97-145; related argument exposure at lines 525-527 and client construction at lines 784-788
Vulnerability Type: Unvalidated credential destination / bearer-token disclosure
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
class AiHiveClient:
    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
def add_common_args(parser):
    parser.add_argument("--api-key", help="AI Hive API Key (sk-api-*)")
    parser.add_argument("--base-url", help=f"API Base URL (default {DEFAULT_BASE_URL})")
    parser.add_argument("--verbose", action="store_true", help="Verbose logging")
python
config = Config(
    api_key=getattr(args, "api_key", None),
    base_url=getattr(args, "base_url", None),
    verbose=getattr(args, "verbose", False),
)
client = AiHiveClient(config)

Technical Analysis

The API destination is accepted from three caller-controlled sources:

  1. The --base-url command-li ...[truncated 2590 chars]
Remediation
View remediation

Remediation Suggestions

  1. Restrict the default deployment to the official endpoint

    Require the normalized origin to match:

    text
    https://ai-hive.iclip.cn
    

    Reject other schemes, hosts, embedded credentials, fragments, and unexpected ports.

  2. Use an explicit allowlist when alternate deployments are required

    Enterprise endpoints should be listed in trusted configuration controlled by an administrator. Do not treat an arbitrary CLI argument, environment variable, or user-editable configuration value as a trusted credential destination.

  3. Require HTTPS

    Reject plaintext HTTP endpoints. Validate the parsed URL with a URL parser rather than string-prefix checks.

  4. Bind credentials to trusted origins

    Add the bearer header only after confirming that the request destination matches an approved origin. Redirects should either be disabled for authenticated calls or checked so the authorization header is never forwarded to a different origin.

  5. Require explicit confirmation for exceptional endpoints

    If development servers must be supported, require an opt-in flag such as --allow-custom-endpoint, display the exact origin receiving the credential, and avoid using production API keys with that mode.

  6. Harden configuration handling

    Preserve the existing 0600 permission enforcement, but validate base_url immediately after loading it. Consider removing base_url from ordinary user configuration when only the official service is supported.

  7. Add security tests

    Test rejection of HTTP URLs, deceptive subdomains, embedded credentials, alternate ports, malformed URLs, and attacker-controlled hosts. Also verify that cross-origin redirects never receive the authorization header.

Vulnerability Patterns
  • 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
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (10)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding

The skill documents and appears to rely on sensitive capabilities including environment access, file read/write, network access, and shell execution, but it does not declare any explicit tool scope or permissions boundary. This creates an authorization ambiguity where an agent platform may grant broader access than users expect, increasing the risk of unintended file access, credential exposure, command execution, or network exfiltration during skill use.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The description repeatedly says 'Use this skill for' followed by very broad terms such as 'AI model', 'AIGC', 'ecommerce', 'advertising', and general 'image and video production workflows'. In a markdown skill description, this makes activation boundaries unclear and could cause unintended invocation for routine requests that are not specifically about this Taobao e-commerce image-editing workflow.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The '原始搜索意图' section states that the skill may match users comparing a very wide range of unrelated image/design tools and broad commerce platforms, effectively turning many generic comparison or migration queries into triggers. This lacks clear constraints or negative examples, so users asking about general AI image tools could unintentionally invoke this specific skill.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill enables implicit invocation while exposing a very broad default prompt that can trigger real external actions through AI-HIVE, including uploading reference images, submitting generation jobs, polling task status, and downloading outputs. Without clear trigger constraints, a user request loosely related to e-commerce imagery could cause the agent to invoke the skill unexpectedly, leading to unintended data transfer, third-party processing, and cost-incurring operations.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The module docstring and implemented client/CLI expose broad AI-Hive capabilities including text chat, model querying, media upload, and video generation, while the manifest frames this skill specifically around Taobao e-commerce image generation and editing. Although the skill-specific entrypoint later narrows exposed commands, this file's documented and implemented scope is materially broader than the manifest's stated purpose.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The module 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. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The script's runtime messages, errors, prompts, and help text are consistently Chinese-only, including setup and command guidance. Because this is a code file with user-facing strings and no language-selection mechanism, it imposes a locale choice on users.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

At L021, L089, and multiple usage examples such as L133-L145, the skill is documented as supporting text-to-image generation with optional reference images. However, L340 says the capability requires a reference image, which directly conflicts with the documented intent and usage model.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The placeholder value for the API key uses Chinese text ('请替换为你的APIKey'), which imposes a specific language in user-facing configuration content. The file does not offer an alternative locale or indicate that the Chinese wording is region-specific and intentional.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

The top-level docstring says this is a '通用 AI 能力调用工具' and explicitly lists text chat and video generation. For a skill presented as Taobao e-commerce image generation/editing, that documentation signals a materially different intent than the specialized behavior users would expect from the manifest.

Content

No source excerpt is available for this finding.