Back to skill

Security audit

短剧人物圣经与角色一致性|AI-HIVE

Security checks for vulnerabilities and agentic risk

Overview

The skill broadly fits its AI-HIVE media-generation purpose, but it needs review because its scripts can send an API key to a configurable endpoint and trust remote upload/download URLs.

Install only if you are comfortable giving this skill access to an AI-HIVE API key and using it for media-generation workflows. Avoid custom base URLs unless you fully trust the endpoint, keep the API key scoped and revocable, review all generated commands before running them, and use a virtual environment with pinned dependencies where possible.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/imagegen.py:94
Finding

Caller-Controlled API Endpoint Can Receive the AI-HIVE Bearer Credential

Content
View full analysis

Vulnerability Details

File Location: scripts/imagegen.py:94-99, 128-143, 587; scripts/videogen.py:94-99, 128-143, 587
Vulnerability Type: Arbitrary authenticated endpoint selection and credential disclosure
Risk Level: High

Vulnerable Code

The following implementation is duplicated 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
parser.add_argument("--base-url", help=f"API Base URL (default {DEFAULT_BASE_URL})")

Technical Analysis

The API base URL can be supplied through the --base-url command-line option, the AI_HIVE_BASE_URL environment variable, or the local configuration file. The code performs no validation of the URL scheme or destination hostname before attaching the AI-HIVE bearer credential to requests.

Consequently, an attacker who can influence a copied command, process environment, wrapper script, or configuration file can direct authenticated requests to an attacker-controlled endpoint. The first request sent through the resulting AiHiveClient discloses the ...[truncated 1521 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove runtime base-URL overrides from production distributions when custom endpoints are not operationally required.
  2. If overrides are required for development, place them behind an explicit option such as --allow-unsafe-custom-endpoint.
  3. Before constructing an authenticated client, parse the URL and require:
    • The https scheme.
    • An exact allowlisted hostname.
    • An expected port.
    • No embedded username or password.
  4. Scope the bearer credential to the official AI-HIVE origin and refuse to attach it to any other destination.
  5. Disable HTTP redirects for authenticated API requests, or validate the destination of every redirect before following it.
  6. Treat configuration-file changes as security-sensitive and reject untrusted endpoint values even if they were previously stored.
  7. Add automated tests proving that HTTP URLs, lookalike domains, subdomain suffix tricks, IP literals, and non-allowlisted hosts are rejected.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/imagegen.py:266
Finding

Unvalidated Server-Provided URLs Enable Arbitrary Upload and Download Requests

Content
View full analysis

Vulnerability Details

File Location: scripts/imagegen.py:266-305, 312-332, 401-414; scripts/videogen.py:266-305, 312-332, 401-414
Vulnerability Type: Unrestricted outbound requests and unsafe media destination handling
Risk Level: Medium

Vulnerable Code

The following implementation is duplicated in both scripts/imagegen.py and scripts/videogen.py:

python
def upload_media(client, file_path):
    path = Path(file_path)
    if not path.is_file():
        raise SystemExit(f"File does not exist: {file_path}")

    filename = path.name
    content_type = guess_mime(str(path))
    size = path.stat().st_size

    token = client.create_upload_token(filename, content_type, size)

    media_id = token["mediaId"]
    upload_url = token["upload"]["url"]
    upload_method = token["upload"].get("method", "PUT")
    upload_headers = token["upload"].get("headers", {})

    with open(str(path), "rb") as f:
        try:
            oss_resp = requests.request(
                upload_method, upload_url, headers=upload_headers,
                data=f, timeout=300,
            )
        except requests.exceptions.RequestException as e:
            raise SystemExit(f"Object-storage upload failed: {e}")
python
def download_file(url, out_path, timeout=300):
    try:
        resp = requests.get(url, stream=True, timeout=timeout)
        resp.raise_for_status()
        total = int(resp.headers.get("content-length", 0))
        downloaded = 0
        with open(str(out_path), "wb") as f:
            for chunk in resp.iter_content(chunk_size=8192):
                if chunk:
                    f.write(chunk)
                    downloaded += len(chunk)
python
result_url = item.get("resultUrl")
if not result_url:
    continue
ext = ".mp4" if "video" in task_type.lower() else ".png"
filename = f"{task_type}_{task_id}_{i+1}{ext}"
out_path = out_dir / fil
...[truncated 2561 chars]
Remediation
View remediation

Remediation Suggestions

  1. Parse every upload and download URL before use and require HTTPS.
  2. Maintain separate exact hostname allowlists for approved object-storage upload endpoints and result-delivery CDN endpoints.
  3. Resolve destination hostnames and reject loopback, private, link-local, multicast, reserved, and cloud metadata address ranges for both IPv4 and IPv6.
  4. Revalidate the resolved destination immediately before connection to reduce DNS rebinding risk.
  5. Disable redirects with allow_redirects=False; if redirects are necessary, validate every redirect destination using the same policy.
  6. Restrict upload methods to the documented method, normally PUT, and reject all unexpected methods.
  7. Copy only explicitly approved upload headers rather than forwarding an arbitrary server-provided header dictionary.
  8. Add configurable maximum upload and download sizes. Abort streamed downloads once the limit is exceeded, even when Content-Length is absent or incorrect.
  9. Write downloads to a temporary file, validate the media type and size, and atomically rename the file only after successful validation.
  10. Log destination origins without exposing signed query strings or sensitive headers.

T08 · Insecure Dependencies

Note
Location
SKILL.md:63
Finding

Runtime Dependency Is Installed Without Version or Integrity Pinning

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:63; scripts/imagegen.py:8-12; scripts/videogen.py:8-12
Vulnerability Type: Unpinned third-party dependency and non-reproducible installation
Risk Level: Low

Vulnerable Code

SKILL.md documents the dependency without an audited version or integrity constraint:

markdown
The scripts use `https://ai-hive.iclip.cn/api` by default and require `requests`; local video processing requires `ffmpeg`.

Both scripts/imagegen.py and scripts/videogen.py direct the user to install the package without pinning:

python
try:
    import requests
except ImportError:
    print("Missing dependency: requests. Run pip3 install requests", file=sys.stderr)
    sys.exit(1)

No dependency lockfile, exact version constraint, or package hash is present in the audited directory.

Technical Analysis

The instruction pip3 install requests resolves a mutable package version from the user's configured Python package index. The project therefore does not define the precise dependency artifact that was reviewed or tested.

This creates a non-reproducible supply-chain boundary. A future compromised, incompatible, or unexpectedly changed release could become trusted runtime code without any change to this project. A user with a malicious or misconfigured package index could also retrieve an unintended artifact.

The audit did not identify a currently malicious requests dependency or a typosquatted package name. The risk is the absence of version and integrity controls rather than evidence that the named package is presently compromised.

Attack Path

  1. The user runs the documented pip3 install requests command.
  2. pip queries the configured package index and selects whichever compatible release is currently available.
  3. No project lockfile or hash verifies that the selected artifact is the reviewed release.
  4. If the selected artifact or con ...[truncated 850 chars]
Remediation
View remediation

Remediation Suggestions

  1. Add a dependency file that pins an audited exact version of requests.
  2. Generate and require cryptographic hashes for the package and all transitive dependencies, for example through a hash-locked requirements file.
  3. Install dependencies in an isolated virtual environment rather than the system Python environment.
  4. Document the trusted package index explicitly and avoid untrusted extra indexes.
  5. Add automated dependency vulnerability scanning and a controlled update process.
  6. Review and regenerate the lockfile whenever dependencies are intentionally upgraded.
  7. Pin or document minimum supported versions of external executables such as ffmpeg where reproducibility requirements apply.
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 (23)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The skill's declared behavior emphasizes role cards and continuity assets, but the implementation reportedly exposes undeclared generic image generation, model enumeration, and account-information retrieval while lacking the specialized outputs it promises. This kind of purpose drift undermines trust and can lead to overscoped access, unexpected charges, and data exposure because reviewers cannot accurately assess what the skill will do from its metadata.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The skill's declared behavior emphasizes role cards and continuity assets, but the implementation reportedly exposes undeclared generic image generation, model enumeration, and account-information retrieval while lacking the specialized outputs it promises. This kind of purpose drift undermines trust and can lead to overscoped access, unexpected charges, and data exposure because reviewers cannot accurately assess what the skill will do from its metadata.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The skill's declared behavior emphasizes role cards and continuity assets, but the implementation reportedly exposes undeclared generic image generation, model enumeration, and account-information retrieval while lacking the specialized outputs it promises. This kind of purpose drift undermines trust and can lead to overscoped access, unexpected charges, and data exposure because reviewers cannot accurately assess what the skill will do from its metadata.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The skill's declared behavior emphasizes role cards and continuity assets, but the implementation reportedly exposes undeclared generic image generation, model enumeration, and account-information retrieval while lacking the specialized outputs it promises. This kind of purpose drift undermines trust and can lead to overscoped access, unexpected charges, and data exposure because reviewers cannot accurately assess what the skill will do from its metadata.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The file is packaged as a narrowly scoped short-drama character-bible image skill, but the implementation is a broad AI-Hive client supporting chat, model enumeration, media upload, task polling, and video generation. This creates unnecessary capability exposure: if the agent can invoke this script, a user or downstream component may access unrelated privileged operations that bypass the skill’s stated scope and review assumptions.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The file presents itself in code comments as a generic AI capability client while the skill metadata advertises a narrowly scoped short-drama character-bible tool. This mismatch matters because users, orchestrators, or policy layers may grant the skill permissions based on its declared purpose, yet the implementation can perform broad text, image, and video operations beyond that scope.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
87% confidence
Finding

The skill advertises executable commands and operational workflows involving environment variables, local files, network access, and shell usage, but it does not declare any explicit tool scope or permissions boundary. This creates an authorization and review gap: a host agent or reviewer cannot easily determine the minimum required privileges, increasing the risk of unintended file, network, or shell actions if the skill is invoked automatically.

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 hard-codes Chinese output and a specific production style without indicating user choice or consent. While not directly a code-execution flaw, this can cause misalignment with user intent, obscure system behavior, and make unintended skill invocation more confusing or harder to detect when combined with implicit activation.

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 auto-select this skill for loosely related requests. Because this skill can generate runnable AI-HIVE commands and production workflows, unintended invocation could cause users to receive operational instructions or content-generation flows they did not explicitly request, including in higher-risk marketing or media contexts.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The file-level docstring and argparse description hard-code a Chinese-language skill name, and the generated data also uses Chinese-language labels. This creates a locale-specific experience without any user opt-in or documented justification, which matches the language/locale policy violation criteria.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The file implements a general-purpose ffmpeg editing utility, which is materially unrelated to the declared skill purpose of generating short-drama character bibles and role-consistency artifacts. Capability drift like this is risky because it expands the skill's operational surface to local media manipulation and file handling that users and reviewers would not expect from the published description.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

Even though the subprocess usage is not directly vulnerable to shell injection, embedding subprocess-based ffmpeg execution in a skill whose stated function is character-bible generation introduces hidden system-level capabilities. In context, the mismatch makes the skill more dangerous because it can read and transform local media files and invoke external binaries outside the user's reasonable expectation for this workflow.

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
94% confidence
Finding

The docstring explicitly describes a general-purpose AI tool, contradicting the specialized packaged skill identity. Misleading or inconsistent scope declarations are dangerous because security review, user consent, and orchestration policy may rely on the manifested purpose while the code implements much broader behavior.

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 CLI messages are written in Chinese, which effectively constrains the skill to a single language. There is no opt-in, language selection mechanism, or documented justification that this is a region-specific skill, so this is a natural-language locale policy concern.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

Retrieving user account details and wallet balance is not needed to generate short-drama character-bible images. Unnecessary access to account metadata increases privacy and reconnaissance risk, especially because a skill that appears image-focused may still expose financial/account information to callers or logs.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

General text chat is outside the declared purpose of a character-bible/image-generation skill. Extra text-generation capability broadens misuse potential, allowing the skill to be repurposed for arbitrary model interaction under the same API credentials and trust boundary.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

Video generation materially exceeds the advertised role of this image-focused character-bible skill. This scope mismatch can defeat least-privilege expectations and enable higher-cost or more sensitive generation workflows than users, reviewers, or orchestrators intended to permit.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Describing the module as a general AI tool while distributing it as a specialized skill creates a trust and transparency problem. This can mislead reviewers and automated governance systems into approving a component whose effective capabilities are broader than the advertised use case, increasing the risk of misuse under an inappropriate trust label.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

This code file contains user-facing natural-language descriptions and CLI help text in Chinese, starting with the module docstring and continuing throughout the script. Because the skill does not offer an English or user-selectable language option, it effectively forces a specific language/locale without opt-in.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The module includes a general-purpose text chat API wrapper unrelated to the stated task of building short-drama character bibles and consistency assets. In a skill ecosystem, unnecessary generic LLM access broadens abuse potential, such as using a trusted specialized skill as a covert general chat or content-generation primitive.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The embedded metadata brands the module as a specialized character-consistency skill, but the codebase still contains broad reusable generation and API client functionality. Even though the final skill entrypoint is narrower than the generic CLI, retaining broad latent functionality increases the chance of accidental exposure, reuse, or policy bypass in systems that trust metadata rather than actual reachable behavior.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

Querying wallet balance/user info and enumerating all available models are operational capabilities of a general API client, not an obvious requirement for a skill whose stated purpose is generating character bibles and consistency assets. These features indicate the file is serving as a reusable platform tool rather than a narrowly scoped production skill.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.