Back to skill

Security audit

GPT Image 2 商品详情页

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches an AI Hive image-generation workflow, but it can send the user's API key to a configurable API host without validation.

Review this before installing if you will use a real AI Hive API key. Only use the default AI Hive base URL, check that AI_HIVE_BASE_URL and ~/.ai-hive/config.json have not been changed to an untrusted host, and avoid installing dependencies from untrusted pip mirrors. Treat uploaded reference files as being sent to the AI Hive service.

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

Unvalidated Custom API Endpoint Can Receive the Bearer Credential

Content
View full analysis

Vulnerability Details

File Location: scripts/imagegen.py, lines 85–121
Vulnerability Type: Unrestricted credential forwarding to a configurable 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
        )

Technical Analysis

The API base URL can be supplied through the --base-url argument, the AI_HIVE_BASE_URL environment variable, or the local configuration file. The value is accepted without validating its scheme or destination host.

The HTTP client subsequently attaches the AI Hive API key as an Authorization: Bearer header to every request made through that base URL. Consequently, any party capable of influencing one of the base URL configuration sources can redirect authenticated requests to an arbitrary server. The code also permits a plaintext HTTP endpoint, which could expose the credential to network interception.

This behavior is especially sensitive because changing a base URL can appear to be an ordinary configuration operation while silently changing the recipient of a reusable credential.

Attack Pat

...[truncated 1321 chars]

Remediation
View remediation

Remediation Suggestions

  1. Require the API base URL to use HTTPS.
  2. Allowlist the expected production host, ai-hive.iclip.cn, before attaching the bearer credential.
  3. Reject URLs containing user information, fragments, unexpected ports, or non-HTTP schemes.
  4. If custom endpoints are a legitimate requirement, require an explicit high-friction option such as --allow-custom-api-host and display the exact credential recipient before proceeding.
  5. Construct authentication headers only after validating the destination. Do not automatically forward production credentials to arbitrary custom hosts.
  6. Consider maintaining separate credentials for development or self-hosted endpoints.
  7. Add automated tests covering HTTP URLs, deceptive subdomains, embedded user information, malformed URLs, redirects, and unapproved hosts.
  8. Disable cross-origin credential forwarding during redirects or reject redirects to a different origin.
  9. Advise affected users to revoke and rotate keys if an untrusted base URL may previously have been configured.

T08 · Insecure Dependencies

Note
Location
SKILL.md:70
Finding

Runtime Dependency Is Installed Without Version or Integrity Pinning

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, line 70
Vulnerability Type: Unpinned third-party dependency installation
Risk Level: Low

Vulnerable Code

bash
pip3 install requests

Technical Analysis

The installation instruction resolves requests dynamically from the package index configured in the user's pip environment. It does not specify a reviewed version, lock transitive dependencies, verify package hashes, or identify a trusted package index.

As a result, the installed code can vary between installations. Security and behavior depend on the current package-index state, local pip configuration, and the newest package version available at installation time. A compromised or maliciously configured mirror could provide an unauthorized artifact, while a future incompatible release could unexpectedly alter runtime behavior.

This is a supply-chain hardening weakness rather than evidence that the legitimate requests package is malicious.

Attack Path

  1. An attacker compromises or controls the package index or mirror selected by the user's pip configuration, or otherwise causes pip to resolve an unauthorized artifact.
  2. The user follows the documented pip3 install requests instruction.
  3. Pip downloads the currently resolved package and dependencies without checking project-provided hashes.
  4. The package is installed into the user's Python environment.
  5. When scripts/imagegen.py imports requests, any malicious code embedded in the installed package can execute with the privileges of the user running the Skill.

Impact Assessment

A malicious dependency would execute with the local privileges of the installing or invoking user. Depending on those privileges, it could access user-readable files, environment variables, the AI Hive API key, network resources, and generated or uploaded media.

The practical likelihood is limited when the official Python Package Index and l ...[truncated 169 chars]

Remediation
View remediation

Remediation Suggestions

  1. Add a reviewed dependency file that pins requests and all transitive dependencies to known-compatible versions.

  2. Record cryptographic hashes and install with hash verification, for example:

    bash
    python3 -m pip install --require-hashes -r requirements.txt
    
  3. Generate and review the lock file through a reproducible dependency-management process.

  4. Document the expected trusted package index and avoid untrusted extra indexes.

  5. Periodically update pinned dependencies after vulnerability and compatibility review.

  6. Run dependency vulnerability scanning in continuous integration.

  7. Prefer installation inside an isolated virtual environment rather than modifying a shared or privileged Python environment.

  8. Advise users not to run the dependency installation command with elevated operating-system privileges.

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

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

描述强调的是一个面向商品详情页/电商详情视觉的专用 GPT Image 2 技能。但代码主体是通用 AI Hive API 客户端与命令行工具,包含 chat、image、video、models、user-info、upload、task、init 等多个与商品详情页专用生成无关的能力。虽然最终 skill_main 将 generate 固定到 public_model_gpt_image_2,部分贴合“GPT Image 2 图片生成”,但该技能仍公开 task、upload、init 命令,并且整体代码块的主要行为明显超出“设计商品详情页模块图片”。因此存在实质性描述—行为不一致,属于能力范围明显大于声明的情况。

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The file is presented as a narrowly scoped GPT Image 2 product-detail-page skill, but actually ships a generic AI Hive CLI with unrelated capabilities including chat, video generation, account queries, uploads, and task management. This capability mismatch violates least privilege and creates a confused-deputy risk: consumers may trust and authorize a narrowly described skill that can perform much broader actions than expected.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

Video-generation support is materially outside the declared GPT Image 2 image workflow and significantly broadens what the skill can do with the user's credentials and local files. In this context, hidden support for uploading audio/video and submitting video jobs increases exfiltration and spend risk because a user or orchestrator may invoke capabilities they did not intend to grant.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding

The skill invokes shell commands, performs package installation, and relies on a Python script that can access environment variables, files, and the network, yet it declares no explicit tool scope or permissions boundary. This creates an unnecessary trust gap: a user invoking what appears to be a narrow image-generation skill may unknowingly grant broad execution capabilities that could be abused by the backing script or future modifications.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The description says "Use this skill for GPT Image 2 product detail pages、电商详情页长图...信息图和Listing模块," which is a broad catch-all list rather than a narrow activation condition. It does not define boundaries or exclusions, so ordinary requests about product images, infographics, or listings could unintentionally trigger this skill.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The top-level documentation describes a generic AI capability tool rather than the manifest's narrow product-detail-page image skill, signaling deceptive or at least misleading packaging. In a skill ecosystem, such inconsistency is dangerous because reviewers and users often rely on manifest/docs to assess trust boundaries, and mismatches can hide broader operational power.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

This Python file contains its primary docstring, CLI help, prompts, and status messages in Chinese, which effectively forces a specific language for all users. The file does not offer opt-in language selection or indicate that the skill is intentionally limited to a Chinese-speaking or region-specific audience.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

User-info and wallet-balance querying are not required to generate product-detail-page images, yet they expose account metadata and billing-related information through a skill advertised for image creation. While not arbitrary code execution, this is unnecessary access to sensitive account context and can aid profiling, misuse, or unauthorized balance inspection under trusted credentials.

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 text-chat support even though its declared purpose is generating product-detail-page imagery with GPT Image 2. Extra text endpoints expand the reachable API surface and may allow unreviewed prompt handling, data transmission, or cost-incurring operations under the same API key, contrary to user expectations for a single-purpose image skill.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

This markdown file contains user-facing natural language almost entirely in Chinese, which can amount to a language/locale policy issue when no user opt-in or justification is provided. The file does not indicate that the skill is region-specific or that alternate language support is intentionally limited.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
76% confidence
Finding

The file presents the primary description and instructions in Chinese while also embedding an English directive, but it does not state whether the skill should respond in Chinese, English, or match the user's preference. This can create a language policy issue if the skill effectively defaults users into a language or mixed-locale experience without opt-in.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.