Back to skill

Security audit

AI大模型专家|品牌电商带货短剧

Security checks for vulnerabilities and agentic risk

Overview

This skill fits an AI-HIVE media-generation workflow, but it should be reviewed because unsafe endpoint and download handling could expose API keys or write files outside the chosen output folder.

Install only if you trust the publisher and AI-HIVE account context. Do not set AI_HIVE_BASE_URL or --base-url to anything except the legitimate AI-HIVE endpoint, use a limited/revocable API key, avoid uploading sensitive media unless intended, and review downloaded output locations until path sanitization and dependency pinning are fixed.

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:91
Finding

API credentials can be transmitted to an arbitrary endpoint

Content
View full analysis

Vulnerability Details

File Location: scripts/imagegen.py:91-99, 128-143; scripts/videogen.py:91-99, 128-143
Vulnerability Type: Unrestricted API base URL with credential 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
class AiHiveClient:
    """Encapsulates AI Hive OpenAPI HTTP calls."""

    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

Both generation scripts permit the API base URL to be supplied through a command-line argument, the AI_HIVE_BASE_URL environment variable, or the local configuration file. The value is accepted without validating its scheme or hostname.

The client then adds the AI-HIVE Bearer API key to every request made through that base URL. Consequently, an attacker who can influence the command invocation, process environment, or ~/.ai-hive/config.json can redirect authenticated requests to an attacker-controlled service. A URL using plain HTTP would additionally expose the credential to network interception.

This is a confused-deputy and credential-d ...[truncated 1623 chars]

Remediation
View remediation

Remediation Suggestions

  1. Require the default production endpoint to use HTTPS and validate the parsed URL:
    • Scheme must be https.
    • Hostname must exactly match an approved AI-HIVE hostname.
    • Reject embedded credentials, fragments, and unexpected ports.
  2. Do not send an AI-HIVE credential to arbitrary custom endpoints.
  3. If custom endpoints are a required development feature:
    • Disable them by default.
    • Require an explicit unsafe-development flag.
    • Require a separate credential for each endpoint.
    • Display the destination hostname and request interactive confirmation.
  4. Avoid allowing security-sensitive endpoint overrides through ambient environment variables in production.
  5. Add automated tests for plain HTTP, deceptive subdomains, user-info syntax, redirects, and non-allowlisted hosts.
  6. Review redirect handling and ensure authorization headers cannot be forwarded to an untrusted redirect destination.
  7. Advise affected users to revoke and rotate any key that may have been used with an untrusted base URL.

T09 · Insecure Skill Coding Practices

Error
Location
scripts/imagegen.py:397
Finding

Remote task metadata can escape the output directory during result download

Content
View full analysis

Vulnerability Details

File Location: scripts/imagegen.py:397-414; scripts/videogen.py:397-414
Vulnerability Type: Path traversal through unsanitized remote metadata
Risk Level: High

Vulnerable Code

python
# Download results
out_dir = Path(output_dir)
out_dir.mkdir(parents=True, exist_ok=True)
task_type = task.get("taskType", "task")
for i, item in enumerate(succeeded):
    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 / filename
    download_file(result_url, out_path)

# Last frame
for item in succeeded:
    last_frame = item.get("lastFrameUrl")
    if last_frame:
        out_path = out_dir / f"{task_type}_{task_id}_lastframe.png"
        download_file(last_frame, out_path)

The destination is subsequently opened for writing by download_file():

python
with open(str(out_path), "wb") as f:
    for chunk in resp.iter_content(chunk_size=8192):
        if chunk:
            f.write(chunk)

Technical Analysis

The scripts construct local filenames using taskType and taskId values derived from API responses or task identifiers without applying filename sanitization or checking the resolved destination.

A malicious value containing ../ components can traverse outside output_dir. Depending on path construction semantics, an absolute path component can also cause the intended output directory to be discarded. The resulting destination is opened with wb, which creates the file or truncates an existing file.

The content written to that location is obtained from the remotely supplied resultUrl or lastFrameUrl. Neither the destination's containment nor the downloaded content size is validated.

Exploitation requires control or compromise of the API response path, such as through the ...[truncated 1882 chars]

Remediation
View remediation

Remediation Suggestions

  1. Treat all API response fields as untrusted.
  2. Generate local filenames exclusively from locally controlled identifiers, rather than using taskType directly.
  3. If a remote identifier must appear in a filename, normalize it to a strict allowlist such as [A-Za-z0-9_-] and enforce a short maximum length.
  4. Resolve and validate every destination before writing:
    python
    base = Path(output_dir).expanduser().resolve()
    destination = (base / safe_filename).resolve()
    if base not in destination.parents:
        raise SystemExit("Unsafe output path")
    
  5. Reject absolute paths, separators, . components, and .. components in all filename inputs.
  6. Use exclusive file creation or an explicit overwrite-confirmation policy where practical.
  7. Write to a temporary file in the validated output directory and atomically rename it after a successful download.
  8. Enforce a maximum response size using both Content-Length and a streamed byte counter.
  9. Validate download schemes and optionally allowlist trusted result hosts.
  10. Apply the same correction to both imagegen.py and videogen.py, including last-frame downloads.

T08 · Insecure Dependencies

Warning
Location
SKILL.md:117
Finding

Setup instructions install an unpinned third-party dependency

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:117-120
Vulnerability Type: Unpinned third-party dependency installation
Risk Level: Medium

Vulnerable Code

bash
pip3 install requests
python3 "$SKILL_PATH/scripts/videogen.py" init --skill-name ai-model-expert-drama-brand-ecommerce-drama

Technical Analysis

The documented setup process installs requests without an exact version, integrity hash, lockfile, or isolated environment. The command therefore resolves whichever version and transitive dependency set the configured package index considers current at installation time.

This makes installations non-reproducible and expands exposure to upstream compromise, dependency substitution through a malicious package index, or a future incompatible release. Python package installation may execute package build or installation logic, and the installed code is subsequently imported by both generation scripts.

No evidence was found that the project intentionally references a typosquatted package or a malicious repository. The issue is the absence of supply-chain controls around an executable runtime dependency.

Attack Path

  1. A user follows the first-time setup instructions.
  2. The user's package index configuration, mirror, DNS path, or upstream package release supplies a compromised or unintended version.
  3. pip3 install requests downloads and installs that uncontrolled version and its dependency set.
  4. Installation-time code may run under the user's privileges.
  5. The scripts later execute:
    python
    import requests
    
  6. Compromised dependency code can run in the process that has access to the AI-HIVE API key, local media, prompts, generated files, and network connectivity.

Impact Assessment

If the dependency source or selected release is compromised, code can execute with the privileges of the user performing the installation or running the scripts. Potential ...[truncated 425 chars]

Remediation
View remediation

Remediation Suggestions

  1. Declare dependencies in a dedicated requirements or lock file.
  2. Pin an audited exact version and all transitive dependencies.
  3. Include package hashes and install with hash verification, for example:
    bash
    python3 -m pip install --require-hashes -r requirements.txt
    
  4. Use a project-specific virtual environment rather than modifying the global Python environment.
  5. Document the trusted package index explicitly and avoid untrusted mirrors.
  6. Add automated dependency scanning and scheduled update review.
  7. Regenerate and review hashes whenever dependencies are intentionally upgraded.
  8. Prefer reproducible build tooling that locks the complete transitive dependency graph.
Vulnerability Patterns
  • 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
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (15)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

If the skill truly exposes undeclared capabilities like chat endpoints, user-info or balance queries, model enumeration, interactive API-key setup, or different image-generation behavior than advertised, then users may grant trust or provide secrets under false assumptions. In this context, the skill handles API keys, uploads, external network calls, and media assets, so undisclosed behavior increases the risk of unintended data disclosure, unexpected billing actions, or privacy-impacting requests to external services.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

If the skill truly exposes undeclared capabilities like chat endpoints, user-info or balance queries, model enumeration, interactive API-key setup, or different image-generation behavior than advertised, then users may grant trust or provide secrets under false assumptions. In this context, the skill handles API keys, uploads, external network calls, and media assets, so undisclosed behavior increases the risk of unintended data disclosure, unexpected billing actions, or privacy-impacting requests to external services.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding

The skill describes executable workflows that rely on environment variables, local files, network access, and shell commands, but it does not declare any explicit tool scope or permissions. This creates an ambient-authority problem: a host or reviewer cannot easily tell what capabilities the skill expects, increasing the chance of over-privileged execution and unsafe handling of local files, API keys, and remote uploads.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The manifest explicitly sets language: zh-CN, which indicates a fixed language/locale preference. The file does not state that the skill is region-specific or provide an opt-in or alternative language path, so this is a natural-language locale policy concern under the stated rules.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

All user-facing manifest text is written in Chinese, including the default prompt, and the file provides no indication that language is optional or region-specific. Under the policy, forcing a specific language without opt-in can be a natural-language policy violation.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill enables implicit invocation while exposing only broad marketing-style descriptions and a generic default prompt, without a tightly bounded activation scope. This increases the chance the agent will auto-select the skill in loosely related conversations, causing unintended handling of user data or execution of workflows the user did not explicitly request.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The file’s natural-language description and CLI description specify a Chinese-only skill context ('品牌电商带货短剧') without offering any language or locale choice. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale constraint is explicitly documented and justified.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The manifest describes a skill for turning creative inputs into deliverable short-drama and comic-style video outputs via AI-HIVE, but this file includes generic platform operations such as text chat, user account info lookup, model enumeration, arbitrary media upload, and generic task inspection. Those are broader than the stated domain-specific generation purpose and materially expand the skill beyond short-drama/e-commerce content production.

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 and all user-facing CLI guidance are written in Chinese, and there is no indication that users may choose another language or that the skill is intentionally restricted to a Chinese-speaking context. The policy explicitly calls out language/locale constraints as violations when a skill forces a specific language without user opt-in.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The concrete exported skill behavior in the bottom section hard-codes SKILL_CONFIG for 'gpt-image-2' and only exposes generate/task/upload commands for image generation and editing. This is a narrower and different user-facing purpose than the manifest's broader promise of converting scripts, character boards, and reference videos into deliverable short-drama and comic videos.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The file implements a broad-purpose AI Hive client with capabilities well beyond the declared short-drama/e-commerce video skill, including text chat, model enumeration, user-info access, task inspection, and arbitrary media upload. This expands the reachable attack surface and violates least-privilege expectations for a narrowly scoped skill, making misuse, data exposure, or policy bypass more likely if an agent exposes these commands to users or other components.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This code file contains user-facing natural language exclusively in Chinese in the module docstring and throughout the CLI help and prompts, without offering a language choice. The policy requires flagging locale/language constraints when a skill effectively forces a specific language without explicit user opt-in or documented regional justification.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The sample API key placeholder uses Chinese text ("请替换为你的APIKey"), which imposes a specific language in user-facing configuration content. The file does not provide any language option or explain a locale-specific requirement, so it may violate language/locale policy expectations.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

The top-level docstring and earlier parser construction describe a universal CLI covering text chat, image generation, video generation, model queries, and media upload via argparse subcommands. However, the real executable path at the bottom calls skill_main(), whose parser only exposes generate/task/upload/init around a fixed GPT Image 2 image skill, so the documentation actively overstates what this script actually provides when run.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

Although the wrapper brands itself as a short-drama video skill, it still exposes generic utility subcommands for raw media upload and task inspection. These extra entry points undermine the claimed specialization and can be abused to interact with backend resources outside the intended workflow, especially in agent ecosystems that trust the skill description to reflect actual behavior.

Content

No source excerpt is available for this finding.