Back to skill

Security audit

同款服装多场景Lookbook|AI-HIVE

Security checks for vulnerabilities and agentic risk

Overview

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

Review before installing. Use this only with an AI-HIVE key you are willing to use for billable media generation, avoid custom or untrusted base URLs, check AI_HIVE_BASE_URL and ~/.ai-hive/config.json before running it, and confirm prompts, routing, batch size, uploads, and downloads before any generation task is submitted.

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

Bearer Credential Disclosure Through an Unrestricted API Base URL

Content
View full analysis

Vulnerability Details

File Location: scripts/imagegen.py:91-99, 130-143, 583-587, 747-752, 821-834
Vulnerability Type: Server endpoint injection leading to bearer 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
class AiHiveClient:
    """Encapsulates AI Hive OpenAPI HTTP calls."""

    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=api_key, base_url=base_url, verbose=verbose)
client = AiHiveClient(config)
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 client accepts an arbitrary API base URL from the --base-url command-line option, the AI_HIVE_BASE_URL environment variab ...[truncated 2172 chars]

Remediation
View remediation

Remediation Suggestions

  1. Allowlist credential-bearing destinations. Permit the production API key to be sent only to the expected HTTPS origin, such as:

    python
    from urllib.parse import urlparse
    
    ALLOWED_API_HOSTS = {"ai-hive.iclip.cn"}
    
    def validate_base_url(value):
        parsed = urlparse(value)
        if parsed.scheme != "https":
            raise SystemExit("The API base URL must use HTTPS")
        if parsed.hostname not in ALLOWED_API_HOSTS:
            raise SystemExit("The API host is not authorized")
        if parsed.username or parsed.password:
            raise SystemExit("Credentials in the API URL are prohibited")
        return value.rstrip("/")
    
  2. Validate every source. Apply the same validation to CLI, environment, and persisted configuration values rather than validating only the default endpoint.

  3. Separate custom-endpoint credentials. If custom API endpoints are required for development, require a distinct credential explicitly supplied for that endpoint. Never automatically forward the production AI-HIVE key.

  4. Reject plaintext transport. Prohibit http:// URLs and retain TLS certificate verification.

  5. Reduce configuration exposure. Avoid persisting arbitrary API base URLs alongside production credentials. Consider ignoring persisted custom endpoints unless an explicit development mode is enabled.

  6. Add regression tests. Verify that HTTP URLs, unapproved hosts, URLs containing user information, hostname-confusion forms, and attacker-controlled environment values are rejected before any network request occurs.

  7. Respond to suspected exposure. Revoke and rotate any key that may have been sent to an untrusted endpoint, then inspect API usage and billing records for unauthorized activity.

Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • 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
Findings (15)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The skill claims AI-HIVE OpenAPI integration, pricing snapshot retrieval, routing selection, async polling, download handling, and image generation, but the described file only provides blueprint-style local drafting and command examples rather than the claimed operational controls. This mismatch is dangerous because operators may trust the skill to enforce safety, pricing verification, and auditability that are not actually implemented, leading to unintended charges, missing review steps, or unsafe downstream execution assumptions.

Content

No source excerpt is available for this finding.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 81)May include surrounding context.

md
python3 scripts/imagegen.py init --skill-name fashion-multi-scene-lookbook-ai-hive

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 83)May include surrounding context.

md
python3 scripts/imagegen.py init --skill-name fashion-multi-scene-lookbook-ai-hive

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding

The skill advertises executable workflows and includes runnable command examples that rely on environment variables, filesystem access, networking, and shell execution, but it does not declare any explicit tool scope or permission boundaries. In an agent environment, this can lead to overbroad implicit capability use, making it easier for the skill to access sensitive resources or perform billable/external actions without clear sandboxing or operator review.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The activation criteria are broad and include common phrases and generalized user intents, which can cause the skill to trigger in contexts where the user did not explicitly request this workflow. Overbroad triggering increases the chance of unintended tool use, irrelevant execution suggestions, or accidental progression toward billable/networked actions in adjacent conversations.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The default prompt forces Chinese output regardless of the user's language preference, which can override user intent and reduce transparency about what the skill is doing. In a security context this is lower severity than code execution issues, but it can impair review, consent, and operator understanding of generated workflows or commands, especially when the skill emits runnable API instructions.

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 without any visible trigger constraints, so the platform may auto-select it for loosely related requests. Because this skill can generate runnable AI-HIVE commands and production workflows for external API use, accidental invocation could cause unintended operational actions, unwanted API usage, or broaden exposure to prompt-injection content from ordinary user queries.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The file is a generic AI-Hive CLI that supports chat, image, video, upload, model enumeration, user-info, and task polling, while the skill manifest describes a narrowly scoped lookbook image-generation skill. This capability mismatch violates least privilege and expands the attack surface: an invoking agent or user can access unrelated operations that may incur cost, expose account metadata, or be repurposed beyond the declared skill purpose.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This Python skill’s natural-language interface is written entirely in Chinese in its module docstring and user-facing prompts, which effectively enforces a specific language/locale for users. The file does not offer any language selection, fallback, or opt-in mechanism, and there is no indication that the skill is intentionally limited to a China-specific or Chinese-only compliance context.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

Exposing user account and wallet inspection is unnecessary for generating lookbook images and can reveal billing or account metadata to contexts that should not have it. In a skill ecosystem, this broadens data access and may enable reconnaissance about balances, subscriptions, or account state for social engineering or abuse planning.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Generic text chat is outside the stated purpose of producing lookbook image sets and allows the skill to act as a broad LLM proxy using the configured API key. That increases the chance of misuse, unintended data processing, and billable actions unrelated to the approved workflow, especially if an agent can invoke hidden or undocumented commands.

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 a lookbook image-set skill and can be abused to create unrelated media, consume more credits, and process additional user data types such as audio/video. Because the manifest explicitly frames the skill as a fixed-product multi-scene lookbook image tool, this hidden extra capability makes the skill more dangerous by masking a larger operational scope.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
73% confidence
Finding

The skill description and title are written entirely in Chinese and define invocation using Chinese terms, with no indication that users may interact in other languages or choose a preferred locale. This can be a language/locale policy issue when a skill appears to assume a fixed language without documenting that constraint or making it optional.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

The file hard-codes a Chinese title in the module docstring and argparse description, with no option for the user to choose language or locale. This can violate language/locale policy when a skill is expected to be usable in the user's preferred language unless the locale restriction is explicitly justified.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

At the top of the file, the documentation describes the script as a '通用 AI 能力调用工具' that wraps chat, image, video, model query, upload, and polling. That directly conflicts with the enclosing skill's declared intent as a specialized fashion multi-scene lookbook generator, indicating intent-level divergence between documentation and the actual skill role.

Content

No source excerpt is available for this finding.