Back to skill

Security audit

多肤色多体型模特套图|AI-HIVE

Security checks for vulnerabilities and agentic risk

Overview

The skill largely matches its AI-HIVE image workflow purpose, but it needs Review because its API script can send a user's AI-HIVE key to an arbitrary configured API host.

Review before installing. Use only the default AI-HIVE endpoint unless you fully trust a custom endpoint, avoid setting AI_HIVE_BASE_URL from untrusted instructions, use a limited or disposable API key if possible, and confirm parameters before any generation that may spend credits or upload private media.

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

Unrestricted API Endpoint Can Receive the Bearer API Key

Content
View full analysis

Vulnerability Details

File Location: scripts/imagegen.py, lines 91–99 and 130–143
Vulnerability Type: Unvalidated custom API endpoint causing credential 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
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 command-line option, the AI_HIVE_BASE_URL environment variable, or the local configuration file. The value is accepted without validating its scheme or hostname.

AiHiveClient subsequently attaches the AI-HIVE bearer token to every request made to the resulting endpoint. Consequently, an attacker-controlled URL can receive the complete Authorization: Bearer ... header. The implementation also permits plaintext HTTP endpoints, which can expose the token to network interception.

This violates endpoint trust-boundary validation and credential-scoping principles. A production credential intended for AI-HIVE must not automatically be transmitted to arbitrary hosts selected through untrusted runtime configuration.

Attack Path

...[truncated 1291 chars]

Remediation
View remediation

Remediation Suggestions

  1. Restrict authenticated requests to the expected AI-HIVE origin by default:
    • Require the https scheme.
    • Require the exact approved hostname, such as ai-hive.iclip.cn.
    • Reject embedded credentials, unexpected ports, fragments, and ambiguous hostnames.
  2. Remove arbitrary --base-url and AI_HIVE_BASE_URL overrides from normal production use if they are unnecessary.
  3. If custom endpoints are required for development:
    • Require an explicit unsafe-development flag.
    • Display the resolved destination and request confirmation.
    • Use a separate development credential rather than the production AI-HIVE key.
    • Never attach an AI-HIVE credential to a host outside the approved allowlist.
  4. Reject plaintext HTTP endpoints because bearer credentials would otherwise be exposed in transit.
  5. Parse URLs with urllib.parse.urlparse rather than relying on string operations, and compare normalized scheme, hostname, and port against an allowlist.
  6. Add automated tests covering malicious hosts, HTTP URLs, user-info syntax, subdomain confusion, unexpected ports, and environment/configuration poisoning.
  7. Document credential rotation procedures and advise users to revoke and replace any key that may have been sent to an untrusted endpoint.

A hardened validation pattern could resemble:

python
from urllib.parse import urlparse

ALLOWED_API_ORIGINS = {
    ("https", "ai-hive.iclip.cn", 443),
}

def validate_base_url(value):
    parsed = urlparse(value)
    port = parsed.port or 443

    if parsed.username or parsed.password:
        raise SystemExit("Credentials are not permitted in the API URL")
    if parsed.fragment:
        raise SystemExit("Fragments are not permitted in the API URL")
    if (parsed.scheme, parsed.hostname, port) not in ALLOWED_API_ORIGINS:
        raise SystemExit("Untrusted API endpoint")
    return value.rstrip("/")
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 (12)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The declared description promises a full AI-HIVE image-generation workflow for multi-skin-tone/multi-body-type fashion model sets, with external API operations and deliverable creation. The supplied code does none of that. Its sole function is to create a draft JSON brief from command-line arguments. This is a materially different primary purpose, not merely an implementation subset, because the core advertised capabilities—generation, API integration, upload, pricing, polling, and download—are absent.

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 narrowly scoped diverse-model catalog image skill, but it actually exposes broad capabilities including generic chat, video generation, model enumeration, user-info access, and arbitrary media upload. This scope mismatch is dangerous because users, orchestrators, or policy layers may grant or trust the skill based on its declared purpose while the code enables materially broader actions and data access.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
95% confidence
Finding

Generic text chat capability is outside the skill's advertised image-generation purpose and creates an undeclared general-purpose model access path. That broadens the skill from a constrained media workflow into a flexible prompt execution surface, which can be abused to bypass intended controls, consume resources, or perform tasks users and reviewers did not authorize.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

Video generation is a substantial capability expansion beyond the stated purpose of producing diverse model image sets. Because video models can process more media types and produce richer synthetic content, including this path increases abuse potential, policy evasion risk, and cost exposure under the guise of an image-only skill.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding

The skill includes executable code examples and operational guidance implying use of environment variables, file access, shell execution, and network calls, but it does not declare any explicit tool scope or permission boundaries. This is dangerous because an agent may invoke the skill with broader capabilities than intended, increasing the chance of unreviewed outbound requests, local file access, or shell actions when handling user-controlled inputs.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The trigger list contains broad phrases such as '跨境电商' and 'AI模特', which can match many unrelated user requests and cause the skill to activate outside its narrow intended use. Over-broad activation is dangerous because it can route ordinary conversations into a workflow that performs uploads, network calls, and potentially billable generation steps based on incomplete or irrelevant user intent.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The default prompt hard-codes Chinese output rather than adapting to the user's language choice, which can reduce transparency and informed consent around what the skill is doing. In a workflow that generates production-ready instructions and runnable commands, forcing a language may cause users to miss warnings, misunderstand generated actions, or fail to notice problematic content, especially in multilingual or cross-border commerce settings.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill enables implicit invocation with no trigger boundaries, exclusions, or narrowing conditions, which can cause the agent to invoke this skill in conversations that only loosely match its domain. Because this skill can produce production-ready workflows and runnable AI-HIVE commands tied to external content-generation operations, overbroad auto-invocation increases the risk of unintended execution paths, user confusion, and policy-bypassing assistance in sensitive commercial-image contexts.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The docstring and CLI description identify the skill entirely in Chinese, and the emitted skill value is also fixed to a Chinese-only label. There is no natural-language indication that users may choose another language or that the locale restriction is required for a region-specific purpose, which can violate the language/locale policy.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The module docstring explicitly frames the file as a general AI capability tool, which contradicts the published skill description as a specialized diverse-model catalog image skill. This inconsistency is dangerous because it signals the code was repurposed without proper re-scoping, increasing the chance that hidden or undeclared capabilities remain available to callers.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The module docstring and all user-facing prompts throughout the skill are written exclusively in Chinese, indicating the skill is intended to operate in a single language. The file does not provide any opt-in, fallback, or documented justification for restricting interaction to Chinese, which matches the language/locale policy violation criteria.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

User account and wallet balance retrieval is unrelated to generating catalog images and unnecessarily expands access to potentially sensitive account metadata. In a skill ecosystem, exposing extra account-inspection functionality can leak financial or identity-related information and violates least-privilege expectations for this skill.

Content

No source excerpt is available for this finding.