Back to skill

Security audit

AI珠宝首饰试戴效果图|AI-HIVE

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches its AI-HIVE jewelry image workflow purpose, but it should be reviewed because its API client can forward the user's API key and selected media to an unvalidated custom endpoint.

Install only if you trust the AI-HIVE service and publisher. Use the default endpoint, avoid setting --base-url or AI_HIVE_BASE_URL unless you control and trust that endpoint, use a limited API key where possible, confirm every billable generation, and upload only images or media you are authorized to share with the service.

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

API Credential Disclosure Through an Unrestricted API Endpoint Override

Content
View full analysis

Vulnerability Details

File Location: scripts/imagegen.py:91-100, 130-143, 586-587
Vulnerability Type: Unvalidated service endpoint with bearer-token forwarding
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
        )
python
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})")

Technical Analysis

The API base URL can be supplied through a command-line option, the AI_HIVE_BASE_URL environment variable, or the local configuration file. The code removes only trailing slashes and performs no validation of the URL scheme, hostname, port, or trust relationship.

The HTTP client then includes the AI-HIVE bearer credential in every request sent to the resulting endpoint. Consequently, control over any base-URL input is equivalent to control over the destination that receives the API key. This violates the security principle that credentials must only be forwarded to authenticated and explicitly trusted origins.

The issue can also affect uploaded media. After receiving an authenticated upload-token request, ...[truncated 1920 chars]

Remediation
View remediation

Remediation Suggestions

  1. Keep the production API origin immutable unless endpoint overriding is explicitly required for development.
  2. Parse override values with a standard URL parser and require HTTPS.
  3. Enforce an allowlist of approved API hostnames and ports before creating the client.
  4. Reject URLs containing credentials, fragments, unexpected paths, nonstandard ports, or ambiguous host representations.
  5. Bind authorization headers to the approved API origin. Never forward bearer credentials merely because a URL was supplied through CLI, environment, or configuration.
  6. Treat endpoint overrides as an unsafe development feature requiring an explicit option such as --allow-unsafe-endpoint, and display a prominent warning that credentials may be disclosed.
  7. Validate upload-token responses before transmitting files. Require HTTPS and approved object-storage domains, and restrict upload methods to the documented set.
  8. Validate result-download URLs similarly to reduce exposure to malicious or unintended network destinations.
  9. Consider removing base_url from the API-key configuration file so that modification of a credential store cannot silently redirect authentication traffic.
  10. Add automated tests confirming that unapproved schemes, hosts, ports, upload URLs, and download URLs are rejected before any credential or media is transmitted.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • 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 (11)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The skill claims AI-HIVE OpenAPI integration, reference uploads, pricing snapshots, routing, polling, and downloads, but the file only presents workflow text and example commands without evidence of the promised implementation. This mismatch is dangerous because users or orchestrators may trust the skill to perform controlled, auditable external actions when it actually cannot, increasing the risk of deceptive operation, unsafe substitution, or accidental misuse in commerce-related workflows.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding

The skill includes executable code examples that use environment variables, local files, network access, and shell commands, but it does not declare any tool scope or permissions boundaries. In an agent environment, this can lead to overbroad execution capability, making it easier for a prompt or future modification to trigger network calls, file access, or shell usage without explicit user-visible restriction.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The skill name and activation/usage description are written entirely in Chinese and define invocation through Chinese phrases such as 珠宝试戴、首饰上身、AI模特, with no indication that other languages are supported. This can constitute a language/locale policy issue because the skill appears to require a specific language without explicit user opt-in or documented regional limitation.

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-requires Chinese output without checking the user's language preference, which can override user intent and reduce transparency about what the agent is doing. While not a direct code-execution risk, forced language behavior can impair informed consent, reviewability, and safe use—especially for workflows involving commercial content generation and external service operations.

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 activation constraints, which increases the chance the agent will call this capability automatically based on loose semantic matching rather than clear user consent. Because this skill can drive external AI-HIVE workflow generation and API-related actions, unintended invocation could trigger unauthorized processing, third-party data handling, or confusing behavior when the user did not explicitly ask to use the skill.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The file is packaged as a jewelry try-on preview skill, but the implementation exposes a much broader generic AI-Hive client with chat, image, video, model discovery, uploads, and task polling. This violates least functionality and increases the attack surface, making it easier for callers to repurpose the skill for unintended capabilities outside the declared scope and governance controls.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The module docstring explicitly describes a generic AI capability tool, contradicting the declared jewelry try-on purpose. This mismatch is dangerous because reviewers, users, and orchestration layers may rely on metadata and descriptions for trust decisions, while the code actually enables broader actions than expected.

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 guidance in this file are written in Chinese, and the CLI prompts and status messages throughout the script assume Chinese as the interaction language. There is no indication of user choice, locale detection, or documentation that this is a China-specific skill, so this creates a language/locale policy concern.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

Text chat capability is unrelated to a jewelry try-on image generation skill and enables arbitrary prompt-based interaction with external models using the same API credentials. In a skill ecosystem, this can be abused to bypass intended policy boundaries, exfiltrate sensitive user content via prompts, or use the skill as a general-purpose LLM proxy rather than a constrained image tool.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

Video generation is outside the declared purpose of a jewelry try-on preview image skill and materially expands the skill's capabilities to more expensive and potentially higher-risk media synthesis. This broadening allows misuse for unrelated content generation and undermines trust in the skill's advertised narrow function.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The file embeds the skill name and description entirely in Chinese in user-facing text, including the module docstring and argparse description. Because this is a code file and no opt-in, locale selection, or justification for a Chinese-only interface is provided, this appears to impose a specific language choice in a way that may violate language/locale policy.

Content

No source excerpt is available for this finding.