Back to skill

Security audit

AI UGC广告生成器|AI-HIVE

Security checks for vulnerabilities and agentic risk

Overview

The skill largely fits AI-HIVE UGC ad creation, but it needs Review because its API client can send the user's bearer token to an unrestricted custom base URL and it has broader activation and client capabilities than the narrow ad-generator label implies.

Install only if you are comfortable giving this skill an AI-HIVE API key and allowing it to upload selected media, submit potentially billable generation tasks, and write outputs locally. Do not use custom base URLs unless you fully trust and control the endpoint; prefer the default AI-HIVE URL, keep the API key scoped/rotatable, and review generated commands before running them.

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

Error
Location
scripts/imagegen.py:60
Finding

API Key Disclosure Through an Unrestricted Custom Base URL

Content
View full analysis

Vulnerability Details

File Location: scripts/imagegen.py:60-99, 130-143; duplicated in scripts/videogen.py:60-99, 130-143
Vulnerability Type: Credential disclosure through an attacker-controlled API endpoint
Risk Level: High

Vulnerable Code

python
def __init__(self, api_key=None, base_url=None, verbose=False):
    self.verbose = verbose
    self.api_key = self._resolve_api_key(api_key)
    self.base_url = self._resolve_base_url(base_url)

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 scripts obtain the API base URL from a command-line argument, the AI_HIVE_BASE_URL environment variable, or the persistent configuration file. No validation requires HTTPS or restricts the destination to the legitimate AI-HIVE hostname.

The client subsequently attaches the AI-HIVE bearer token to every request sent to that destination. Consequently, anyone able to influence command arguments, environment variables, or ~/.ai-hive/config.json can redirect authenticated requests to an endpoint they control.

This behavior exceeds the minimum privil ...[truncated 1755 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove end-user base URL overrides unless custom endpoints are a documented and necessary feature.
  2. Allowlist the canonical origin, including scheme and hostname:
    • Scheme: https
    • Hostname: ai-hive.iclip.cn
    • Expected API path prefix: /api
  3. Reject URLs containing user information, fragments, unexpected ports, or hostnames that merely end with a trusted-looking suffix.
  4. Never attach the AI-HIVE token to a destination that has not passed origin validation.
  5. If custom deployments must be supported, use a separate credential for each endpoint and require explicit interactive confirmation before sending credentials to a new origin.
  6. Reject plaintext HTTP, including for custom endpoints.
  7. Apply the same correction to scripts/imagegen.py and scripts/videogen.py.
  8. Add tests proving that command-line, environment, and configuration-file values cannot redirect the bearer token to an unauthorized host.
  9. Rotate any API key that may already have been used while an untrusted base URL was configured.

T08 · Insecure Dependencies

Warning
Location
scripts/imagegen.py:8
Finding

Unpinned Runtime Dependency Installation

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:67; scripts/imagegen.py:8-17; scripts/videogen.py:8-17
Vulnerability Type: Uncontrolled third-party dependency resolution
Risk Level: Medium

Vulnerable Installation Command

bash
pip3 install requests

The scripts recommend this command when the dependency is missing, while the project contains no pinned requirements file, lockfile, or package-integrity hashes.

Technical Analysis

Installing requests without an exact version or lockfile allows the package manager to resolve whichever release and transitive dependencies are available at installation time. The result is not reproducible and can change after the Skill has been reviewed.

The command also relies on the user's active package-index configuration. In an environment configured with an untrusted or compromised index, dependency resolution may install attacker-controlled artifacts. Even when the official package index is used, an unreviewed future release or changed transitive dependency can introduce incompatible or vulnerable behavior.

No evidence was found that the current project intentionally names a typosquatted package or retrieves a known malicious package. The risk arises from unsafe, unconstrained dependency installation rather than from a confirmed malicious dependency currently present in the repository.

Attack Path

  1. The victim invokes an image or video script on a system where requests is not installed.
  2. The script instructs the victim to execute pip3 install requests.
  3. The package manager resolves the current package and transitive dependency versions using the victim's configured package indexes.
  4. A compromised index, malicious mirror, compromised future release, or unsafe dependency version supplies executable installation or runtime content.
  5. The package executes with the privileges of the user running pip, potentially affecting that user's Pytho ...[truncated 544 chars]
Remediation
View remediation

Remediation Suggestions

  1. Add a reviewed dependency manifest with an exact requests version and exact transitive versions.
  2. Generate a lockfile and include cryptographic hashes for downloaded distributions.
  3. Replace the generic installation instruction with installation from the reviewed lockfile.
  4. Recommend installation inside a dedicated virtual environment rather than the system Python environment.
  5. Document the trusted package index and use secure HTTPS package sources.
  6. Integrate dependency vulnerability and integrity scanning into release checks.
  7. Periodically update pinned versions through a controlled review process.
  8. Apply identical dependency guidance to both generation scripts and SKILL.md.
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
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (20)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

A skill presented as a specialized AI UGC ad generator appears to function more like a general AI-HIVE media/model CLI, including generic text/image operations and user account retrieval that are not part of the promised workflow. This overbroad behavior weakens least-privilege expectations and can lead to accidental misuse, data access, or unauthorized cost-incurring actions under a misleading label.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

A skill presented as a specialized AI UGC ad generator appears to function more like a general AI-HIVE media/model CLI, including generic text/image operations and user account retrieval that are not part of the promised workflow. This overbroad behavior weakens least-privilege expectations and can lead to accidental misuse, data access, or unauthorized cost-incurring actions under a misleading label.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

A skill presented as a specialized AI UGC ad generator appears to function more like a general AI-HIVE media/model CLI, including generic text/image operations and user account retrieval that are not part of the promised workflow. This overbroad behavior weakens least-privilege expectations and can lead to accidental misuse, data access, or unauthorized cost-incurring actions under a misleading label.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding

The skill advertises and demonstrates capabilities that require sensitive operations such as environment-variable access, filesystem interaction, shell execution, and network access, but it does not declare any tool scope or permission boundary. This creates an authorization and review gap: downstream systems or reviewers cannot easily determine what the skill is allowed to do, increasing the chance of unexpected API use, local file access, or command execution.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

This markdown file defines when to use the skill, so SQP-1 applies. Several listed triggers are generic content categories rather than specific invocation phrases, and the scope line about users working in ecommerce or social media scenarios is especially broad, which increases the chance of matching ordinary requests that are not specifically asking for this skill.

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 (production-ready Chinese workflow) without checking user preference. While not a direct code-execution issue, forced language output can degrade transparency and user comprehension, especially for safety-sensitive ad or compliance instructions, increasing the risk that users approve or run workflows they do not fully understand.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The manifest enables implicit invocation with allow_implicit_invocation: true, but the activation scope is only loosely described in natural language metadata and not constrained by explicit technical guardrails. In a skill that can generate ad workflows and runnable commands for external APIs, this increases the chance the agent auto-selects the skill in borderline contexts, causing unintended ad-generation behavior, policy bypass attempts, or misuse for deceptive marketing tasks.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The script description and embedded user-facing strings are entirely in Chinese, including the tool name, default values, and search aliases, with no indication that another language is supported or that the user can opt in to this locale. This can violate language/locale policy when a skill imposes one language by default without documented choice or justification.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/edit_video.py (reported line 20)May include surrounding context.

python
def run(args: list[str]) -> None:
    print(" ".join(args))
    subprocess.run(args, check=True)


def main() -> None:

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The module docstring and subsequent user-facing messages are written entirely in Chinese, and the skill provides no opt-in, selection, or justification for limiting interaction to that locale. This creates a natural-language policy issue because the skill effectively enforces a specific language for prompts, errors, and setup guidance.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

User-info and wallet-balance retrieval are unrelated to generating UGC ad images, yet this file includes direct support for querying them. In a skill ecosystem, unnecessary account-inspection functionality expands the attack surface and could expose billing, identity, or usage information if the skill is invoked beyond its intended purpose.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The file includes generic model enumeration, model lookup across types, pricing snapshot extraction, and text-chat support even though the skill is marketed as a specialized image generator. These extra capabilities allow capability pivoting and make it easier to repurpose the skill for unauthorized tasks, increasing the risk of misuse, overspending, or policy bypass in an environment that trusts the skill's narrow label.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The packaged skill presents itself as a narrowly scoped AI UGC ad image generator, but the file embeds and reuses a much broader generic AI client with extra commands and capabilities. This scope mismatch is dangerous because it violates least privilege and can mislead reviewers or orchestrators into granting a specialized skill access to account inspection, model discovery, and other unrelated operations.

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 presented and implemented as a generic AI capability wrapper, not a narrowly scoped UGC ad video skill. It includes broad model listing, text chat, image generation, upload, and task operations, which expands the callable surface beyond the declared specialized purpose and can enable unintended use through the agent skill.

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 user-facing CLI guidance are written entirely in Chinese, and later help text and prompts follow the same pattern. Because this is a general-purpose skill rather than a clearly region-specific compliance tool, forcing one language without opt-in is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The generic text chat endpoint materially exceeds the scope of a specialized UGC ad video generator. In an agent environment, this can be repurposed for arbitrary model interaction, prompt relay, or policy bypass attempts unrelated to the declared skill, undermining least-privilege design.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

The script writes JSON output to a user-specified path using write_text, which can overwrite an existing file, but there is no confirmation prompt or explicit warning before doing so. Although the resolved path is printed afterward, that disclosure happens only after the write and does not warn the user about the side effect in advance.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The top-level docstring says this is a '通用 AI 能力调用工具' wrapping chat, image, video, model query, upload, and polling capabilities, while the bottom-of-file generated skill configuration and entrypoint package it as a dedicated AI UGC ad image skill. This documentation creates an active intent mismatch about whether the file is a general-purpose client or a narrowly scoped skill.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The top-level docstring describes the file as a '通用 AI 能力调用工具' covering chat, image, video, model query, upload, and polling. However, the embedded SKILL_CONFIG and skill_main define a specialized ai-ugc-ad-generator-ai-hive skill intended specifically for UGC ad video generation, so the documentation actively presents a different intent than the skill wrapper actually advertises.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

Exposing a user-info and wallet-balance query is outside the business purpose of generating UGC ad videos. Even if authenticated, this unnecessarily grants the skill access to account metadata and billing-related information, increasing privacy and reconnaissance risk if the skill is misused or invoked by another component.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.