Back to skill

Security audit

爆款广告A/B创意矩阵|AI-HIVE

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches an AI-HIVE ad-creative workflow, but its API clients can send the user's AI-HIVE key to an untrusted configured endpoint.

Install only if you trust this AI-HIVE integration and are comfortable storing an API key locally. Before running generation or upload commands, verify that no --base-url, AI_HIVE_BASE_URL, or ~/.ai-hive/config.json base_url points anywhere except the intended AI-HIVE HTTPS service, because the current scripts do not enforce that boundary.

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

AI-HIVE API Key Can Be Sent to an Arbitrary Endpoint

Content
View full analysis

Vulnerability Details

File Location: scripts/imagegen.py:91-98, 126-143
Vulnerability Type: Arbitrary authenticated API endpoint
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 image-generation client accepts its API base URL from the --base-url command-line option, the AI_HIVE_BASE_URL environment variable, or the persistent configuration file. It does not require HTTPS, validate the destination hostname, or prevent credentials from being attached to requests sent to a non-AI-HIVE origin.

The client then unconditionally includes the AI-HIVE API key in the Authorization header for requests constructed from that configurable base URL. Consequently, control over any base-URL input is sufficient to redirect the bearer credential to an attacker-controlled HTTP server.

This behavior exceeds the minimum privilege required for the declared integration, which identifies https://ai-hive.iclip.cn/api as the service endpoint.

Attack Path

  1. An attacker influences the execution environment, com ...[truncated 1246 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove runtime base-URL overrides if custom AI-HIVE deployments are not a documented requirement.
  2. Allowlist the expected origin, such as https://ai-hive.iclip.cn, before attaching an API key.
  3. Require HTTPS and reject URLs containing credentials, fragments, unexpected ports, or non-HTTP schemes.
  4. Compare a parsed URL's normalized scheme, hostname, and port against an explicit trusted-origin list.
  5. Never attach the AI-HIVE bearer credential when the request origin differs from the approved API origin.
  6. If custom endpoints are necessary, require a separate credential for each endpoint and an explicit interactive confirmation before first use.
  7. Treat environment and configuration-file endpoint changes as security-sensitive and display the destination origin before authenticated requests.
  8. Add automated tests confirming that HTTP URLs and unapproved hosts are rejected before any network request is made.

T09 · Insecure Skill Coding Practices

Error
Location
scripts/videogen.py:91
Finding

AI-HIVE API Key Can Be Sent to an Arbitrary Video API Endpoint

Content
View full analysis

Vulnerability Details

File Location: scripts/videogen.py:91-98, 126-143
Vulnerability Type: Arbitrary authenticated API endpoint
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 video-generation client duplicates the unsafe endpoint-selection behavior in the image-generation client. The API destination can be supplied through a command-line option, environment variable, or persistent configuration without HTTPS enforcement or trusted-host validation.

All regular client requests attach the AI-HIVE bearer token regardless of the selected destination. An attacker able to influence endpoint configuration can therefore convert an otherwise legitimate video-generation invocation into a credential-disclosure request.

Video and other reference media are uploaded through credentials returned by the selected API endpoint. A malicious endpoint can consequently provide an attacker-controlled upload URL, causing user-selected images, videos, or audio files to be uploaded directly to attacker infrastructure. Althou ...[truncated 1653 chars]

Remediation
View remediation

Remediation Suggestions

  1. Pin authenticated requests to the documented AI-HIVE HTTPS origin.
  2. Remove --base-url, AI_HIVE_BASE_URL, and configuration-file overrides unless custom deployments are essential.
  3. Parse and normalize endpoint URLs, require HTTPS, and enforce an explicit hostname and port allowlist.
  4. Attach the bearer token only after verifying that the final request origin is trusted.
  5. Validate upload-token responses and restrict returned upload URLs to documented, trusted object-storage origins.
  6. Reject redirects to untrusted origins, particularly for requests carrying authorization headers or media content.
  7. Use distinct credentials for custom deployments rather than forwarding an AI-HIVE production key.
  8. Show the API and media-upload destination origins to the user before transmitting credentials or files.
  9. Add tests proving that malicious API origins, plaintext HTTP endpoints, untrusted upload URLs, and cross-origin redirects are rejected.
Vulnerability Patterns
  • 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
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (21)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The skill appears to promise structured marketing-planning outputs but instead exposes broader generation and inspection functionality, including browser/API-key initialization and generic model interactions. That discrepancy can mislead operators into enabling privileged integrations or secrets for a skill that is not actually limited to planning logic.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The skill appears to promise structured marketing-planning outputs but instead exposes broader generation and inspection functionality, including browser/API-key initialization and generic model interactions. That discrepancy can mislead operators into enabling privileged integrations or secrets for a skill that is not actually limited to planning logic.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The skill appears to promise structured marketing-planning outputs but instead exposes broader generation and inspection functionality, including browser/API-key initialization and generic model interactions. That discrepancy can mislead operators into enabling privileged integrations or secrets for a skill that is not actually limited to planning logic.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The skill appears to promise structured marketing-planning outputs but instead exposes broader generation and inspection functionality, including browser/API-key initialization and generic model interactions. That discrepancy can mislead operators into enabling privileged integrations or secrets for a skill that is not actually limited to planning logic.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding

The skill advertises executable workflows that use environment variables, local files, shell commands, and network access, but it does not declare any explicit tool scope or permission boundary. In an agent environment, that omission can lead to over-broad runtime authority, making unintended file access, command execution, or outbound API calls more likely if the skill is invoked automatically.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The trigger conditions rely on broad phrases like A/B广告, 创意矩阵, 素材测试, 广告变体, and 投放素材 without strong contextual constraints. Broad triggers increase the chance of accidental invocation in unrelated conversations, which can unnecessarily expose tool access, encourage over-collection of user inputs, or route benign requests into code-capable workflows.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The natural-language prompt explicitly instructs the skill to produce a "production-ready Chinese workflow," which imposes a specific language choice by default. This is a language/locale policy issue because the file does not offer the user a choice or indicate that Chinese output is optional.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The manifest describes a skill for planning ad creative test matrices and, when generating assets, interacting with the AI-HIVE OpenAPI for configuration, uploads, pricing, routing, polling, and downloads. This file instead implements a local ffmpeg-based video editing CLI (trim, aspect conversion, mute, loudness normalization, concat), which is a materially different operational capability not described in the manifest.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The code invokes external binaries via subprocess to manipulate media files. For a skill described primarily as generating ad-test matrices and brokering AI-HIVE media generation workflows, direct local execution of ffmpeg/ffprobe is an additional capability that is not clearly justified by the stated purpose.

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:

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The module docstring says this is a '通用 AI 能力调用工具' and lists text chat, image generation, video generation, model query, media upload, and task polling as its purpose. That active documentation frames the file as a generic AI-Hive client, which conflicts with the manifest's specific claim that this skill should be used for ad A/B creative matrix generation with controlled-variable testing outputs.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This code’s natural-language interface is written entirely in Chinese, including the module description and subsequent user-facing prompts/help text, but it does not indicate that the skill is China-specific or provide any user opt-in for language/locale. Under the policy, forcing a specific language without choice or justification is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The wrapper marketed as an A/B creative-matrix skill actually exposes broad image generation, upload, and task-management operations. This scope mismatch weakens least-privilege boundaries and allows callers to use the skill as a generic media-generation conduit, including for prompts or asset workflows outside the advertised business purpose and governance expectations.

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 presented and documented as a generic AI capability caller, and it indeed contains broad chat, image generation, model enumeration, upload, polling, and account-related features that exceed the advertised ad-creative/video scope. In a skill ecosystem, this scope mismatch is dangerous because callers may grant or invoke the skill under narrower assumptions while the code exposes materially broader remote actions.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The module docstring and parser descriptions explicitly frame the tool as a generic AI capability caller, which contradicts the specialized identity in the skill metadata. Misrepresentation of capability scope is security-relevant because reviewers and orchestrators may trust the declared purpose when deciding whether to install, grant credentials to, or invoke the skill.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The standalone text chat path allows the skill to act as a general-purpose LLM client unrelated to its declared ad-creative video function. This broadens the operational scope and can be abused to route arbitrary prompts and attached images through the account/API key, undermining trust assumptions, monitoring, and policy controls tied to the skill's narrower purpose.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The image-generation path exposes a general image synthesis capability beyond the declared specialized video/creative-matrix behavior. In a skill marketplace or agent environment, undeclared content-generation channels can be used to bypass intended scope restrictions, consume resources, or generate policy-sensitive media under the guise of a narrower skill.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

This code embeds Chinese-only natural-language strings in the module description, argument parser description, and generated skill metadata. That creates a locale/language constraint without any user opt-in or documented justification, which matches the policy-violation category for forced language or locale.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

The code provides user-info to query wallet/account details and models to enumerate all available TEXT/IMAGE/VIDEO models, which are broad platform-management capabilities. Those functions are useful for a general AI-Hive CLI, but they are not necessary to fulfill the manifest's narrowly described purpose of producing ad creative matrices and related asset-generation workflows.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

This code file contains user-facing natural-language strings and documentation exclusively in Chinese, including setup guidance and runtime messages. Under the policy for language/locale choice, the skill does not indicate any user opt-in or alternative locale, which can amount to forcing a specific language experience.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

The get_user_info capability retrieves account and wallet information that is not needed for producing ad-creative video outputs. Even if the endpoint is legitimate, exposing unnecessary account-information retrieval increases data access surface and can leak billing or identity details when the skill is invoked in a context that only expects media generation.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.