Back to skill

Security audit

短剧预告片原创复刻|AI-HIVE

Security checks for vulnerabilities and agentic risk

Overview

This skill is mostly a disclosed AI-HIVE media workflow, but it can send API credentials to a user-supplied endpoint and submit potentially billable generation jobs without built-in confirmation.

Review generated commands before running them. Do not use a custom --base-url, AI_HIVE_BASE_URL, or stored base_url unless you fully trust that endpoint with your AI-HIVE API key. Confirm costs and batch sizes manually before generation, and only upload media you are authorized to use.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/imagegen.py:91
Finding

API Bearer Credential Can Be Redirected to an Arbitrary Endpoint

Content
View full analysis

Vulnerability Details

File Location: scripts/imagegen.py:91-100, 130-143, 587; scripts/videogen.py:91-100, 130-143, 587
Vulnerability Type: Unrestricted credential-bearing endpoint configuration
Risk Level: High

Vulnerable Code

The same implementation is present in both scripts/imagegen.py and scripts/videogen.py:

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
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")

Technical Analysis

The scripts accept an API base URL from three externally controllable sources:

  1. The --base-url command-line argument.
  2. The AI_HIVE_BASE_URL environment variable.
  3. The persistent base_url property in ~/.ai-hive/config.json.

No origin allowlist, HTTPS requirement, hostname validation, or credential-forwarding warning is applied. After resolving the URL, the clie ...[truncated 2228 chars]

Remediation
View remediation

Remediation Suggestions

  1. Restrict authenticated requests to an explicit allowlist containing the official AI-HIVE origin:

    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("Refusing to send credentials to an untrusted API host.")
        if parsed.username or parsed.password:
            raise SystemExit("User information is not allowed in the API URL.")
        return value.rstrip("/")
    
  2. Apply validation consistently to CLI, environment, and configuration-file values.

  3. If custom endpoints are required for development, require a separate explicit flag such as --allow-custom-endpoint, display the destination origin, and request interactive confirmation before attaching credentials.

  4. Do not reuse an AI-HIVE production credential with a custom endpoint. Require a separately supplied development credential for nonstandard origins.

  5. Reject plaintext HTTP endpoints and unexpected URL components, including embedded credentials, fragments, and suspicious redirects.

  6. Disable automatic redirects for credential-bearing requests or validate every redirect target before forwarding the Authorization header.

  7. Add automated tests confirming that credentials are never sent when the target host is outside the allowlist.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/imagegen.py:465
Finding

Billable Generation Tasks Are Submitted Without Cost Disclosure or Explicit Confirmation

Content
View full analysis

Vulnerability Details

File Location: scripts/imagegen.py:465-491, 682-690, 806-816; scripts/videogen.py:493-533, 828-851
Vulnerability Type: Missing authorization control for financially consequential operations
Risk Level: Medium

Vulnerable Code

Image generation obtains a pricing snapshot but immediately submits the task without displaying the price or obtaining confirmation:

python
def cmd_image(client, args):
    model_entry = client.find_model(args.model, "IMAGE")
    pricing = client.get_pricing_snapshot(model_entry, args.mode)

    # Upload reference images
    image_media_ids = []
    if args.image:
        for img_path in args.image:
            media_id = upload_media(client, img_path)
            image_media_ids.append(media_id)

    # Parse --param key=value
    params = parse_params(args.param)

    result = client.generate_image(
        args.model, args.mode, args.prompt, pricing,
        batch_size=args.batch,
        image_media_ids=image_media_ids,
        params=params,
    )
    task_id = result.get("taskId")
    if not task_id:
        print(json.dumps(result, ensure_ascii=False, indent=2))
        return

The batch option accepts an arbitrary integer without a positive lower bound or model-specific maximum:

python
p.add_argument("--batch", type=int, default=1, help="Generation count (default: 1)")

The Skill wrapper forwards the value directly:

python
def skill_generate(client, args):
    _validate_image_inputs(args)
    forwarded = argparse.Namespace(
        model=SKILL_CONFIG["model"], mode=args.routing,
        prompt=args.prompt, image=args.image, batch=args.batch,
        param=args.param, output_dir=args.output_dir,
        no_download=args.no_download, api_key=args.api_key,
        base_url=args.base_url, verbose=args.verbose,
    )
    print(f"Model: {forwarded.model}")
    cmd_image(client, forwarde
...[truncated 3881 chars]
Remediation
View remediation

Remediation Suggestions

  1. Display a complete preflight summary before uploading media or submitting a task:

    • Model identifier.
    • Routing mode.
    • Pricing snapshot.
    • Batch size.
    • Relevant model parameters.
    • Number and type of files to upload.
    • Estimated charge and maximum possible charge.
  2. Require explicit confirmation:

    python
    answer = input("Submit this potentially billable task? Type 'yes' to continue: ")
    if answer.strip().lower() != "yes":
        raise SystemExit("Task submission cancelled.")
    
  3. Add a clearly named --yes or --non-interactive option for deliberate automation. Do not enable it by default.

  4. Validate image batch size before any upload:

    python
    if args.batch < 1:
        raise SystemExit("--batch must be at least 1")
    if args.batch > model_max_batch:
        raise SystemExit(f"--batch exceeds the model limit of {model_max_batch}")
    
  5. Obtain model_max_batch and parameter constraints from the model configuration instead of relying on a hardcoded assumption.

  6. Support a user-configurable spending ceiling such as --max-cost. Abort if the server-provided pricing estimate exceeds it.

  7. Separate preflight and submission into distinct commands or phases so an agent can inspect and present the plan without creating a task.

  8. Preserve an audit record containing the approved pricing snapshot, model, routing mode, parameters, timestamp, and confirmation mechanism.

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

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

A skill presented as a specialized remake assistant but functioning as a broader media upload/task-management and generation utility can be misused for unrelated or higher-risk operations. This mismatch is especially risky in a copyright-sensitive domain because users may rely on the stated safeguards while the actual implementation lacks the promised structure-breakdown, rewrite, and compliance controls.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

A skill presented as a specialized remake assistant but functioning as a broader media upload/task-management and generation utility can be misused for unrelated or higher-risk operations. This mismatch is especially risky in a copyright-sensitive domain because users may rely on the stated safeguards while the actual implementation lacks the promised structure-breakdown, rewrite, and compliance controls.

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 remake assistant but functioning as a broader media upload/task-management and generation utility can be misused for unrelated or higher-risk operations. This mismatch is especially risky in a copyright-sensitive domain because users may rely on the stated safeguards while the actual implementation lacks the promised structure-breakdown, rewrite, and compliance controls.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

A skill presented as a specialized remake assistant but functioning as a broader media upload/task-management and generation utility can be misused for unrelated or higher-risk operations. This mismatch is especially risky in a copyright-sensitive domain because users may rely on the stated safeguards while the actual implementation lacks the promised structure-breakdown, rewrite, and compliance controls.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
87% confidence
Finding

The skill embeds runnable shell/Python examples that use environment variables, local file paths, network endpoints, and media tooling, but it does not declare any explicit tool scope or permissions boundary. This creates a governance gap: an agent or reviewer may not understand that the skill can drive filesystem, shell, and network-capable workflows, increasing the chance of over-privileged execution or unsafe operator trust.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The invocation criteria are broad enough to capture generic business-content or marketing requests, not just the narrowly authorized short-drama trailer use case. Overbroad triggers can cause the skill to activate in contexts where its media-generation, remake, or promotional guidance is inappropriate, leading to misuse, policy evasion attempts, or unauthorized copyrighted-content adaptation.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The default prompt and description are broad enough to trigger the skill for loosely related requests, which increases the chance of unintended invocation in contexts involving copyrighted trailer imitation, ad claims, or policy-sensitive marketing content. In an agent setting, weak activation boundaries can cause the system to apply this workflow without first verifying authorization, user intent, or compliance constraints.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

Forcing Chinese output in the default prompt without user opt-in can cause the agent to ignore the user's stated language preference or obscure important safety, legal, and authorization checks. In a workflow involving marketing assets, licensing-sensitive remake requests, and executable API commands, reduced user comprehension can increase the risk of accidental misuse or unnoticed policy-violating outputs.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The file hardcodes the skill name and command description in Chinese in user-facing strings. Because there is no indication that this skill is region-specific or that users may opt into another language, this can violate a language/locale policy requiring user choice or justified locale constraints.

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:

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file advertises itself as a specialized short-drama trailer remake image skill, but actually embeds a broad generic AI client with chat, video, model enumeration, upload, task polling, and account-related operations. This creates capability drift: users, orchestrators, or policy layers may trust the skill as narrowly scoped while the code can perform much broader actions than declared, undermining least-privilege and increasing the chance of misuse.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The module docstring and most user-facing CLI help text are written only in Chinese, which effectively forces a specific language for interaction. The file does not offer a language/locale option or state that the skill is intentionally limited to Chinese-speaking users, so this is a natural-language locale policy issue.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

Exposing user-info and wallet-balance retrieval in a media-remake image skill grants access to account metadata unrelated to the stated function. Even if not directly exfiltrated here, unnecessary access to account details expands the attack surface and can leak sensitive commercial information such as balances, identifiers, or subscription state through logs or downstream tooling.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

Generic text chat is outside the declared purpose of this image remake skill and can be used as an unreviewed side-channel to send arbitrary prompts and attached media to the backend. In a skill ecosystem that relies on skill descriptions for trust and policy routing, this mismatch can bypass expectations and enable broader data handling than users intended.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

Including video-generation capability in an image-focused remake skill broadens the effective permissions and data flows beyond what the skill promises. Because the skill domain already involves promotional/media assets, hidden video support increases the risk of unauthorized generation, upload, and download of richer media than expected.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The SKILL_CONFIG values such as example, keywords, search, and title are all fixed in Chinese, shaping the skill's behavior and discoverability around a single language. Because no alternative language support or explicit region-specific justification is provided, this violates the natural-language locale policy criterion.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file is marketed and packaged as a specialized short-drama trailer remake skill, but the implementation is a broad AI-Hive client supporting unrelated capabilities such as generic chat, image generation, model enumeration, uploads, and account queries. This scope mismatch violates least privilege and increases abuse potential because consumers of the skill may grant trust or credentials for a narrow task while the code can perform a much wider set of actions.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The module docstring presents the tool as a general AI capability wrapper, but all user-facing descriptive text is in Chinese and does not indicate that other languages/locales are supported. For a broadly scoped skill, this can violate language/locale policy because it effectively forces a specific language without explicit user opt-in or documented regional limitation.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

User-info and wallet balance querying are not necessary for producing trailer-remake outputs, yet the skill exposes them directly. In a skill context, this expands access to account metadata and billing information beyond user expectations, creating unnecessary privacy and reconnaissance exposure if the skill is invoked or repurposed by an attacker.

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 is outside the stated purpose of a trailer-remake generation skill and allows arbitrary prompt forwarding to the provider. That creates a covert expansion of functionality and data egress risk, because users or upstream agents may unknowingly send unrelated or sensitive text and images through a skill they believe is constrained to video remake workflows.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

Standalone image generation is broader than the declared trailer-remake purpose and gives the skill an additional creative channel that is not necessary for the advertised workflow. This broadens misuse opportunities, including generating unrelated or policy-sensitive assets under the cover of a specialized marketing skill.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

The manifest description defines the skill entirely through Chinese trigger phrases and use cases, with no indication that users may interact in another language or choose their preferred locale. This can violate language/locale policy when a skill implicitly assumes a specific language without opt-in.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

The top-level docstring explicitly says this is a '通用 AI 能力调用工具' covering chat, image, video, model query, media upload, and polling. Later, the same file declares a fixed skill configuration for 'short-drama-trailer-remake-ai-hive' as a specialized image skill. That documentation creates an intent contradiction about whether this file is a narrow skill or a general-purpose API client.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The top-level docstring presents the file as a '通用 AI 能力调用工具' that wraps text chat, image generation, video generation, model querying, media upload, and polling. That documentation conflicts with the actual skill identity and manifest, which claim a focused short-drama trailer remake capability rather than a generic all-purpose AI client.

Content

No source excerpt is available for this finding.