Back to skill

Security audit

AI大模型专家|Minimax H3 视频生成与编辑

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly does what it claims, but its external upload/download workflow has under-scoped local file writes and broad implicit activation.

Install only if you trust AI-HIVE and are comfortable uploading the selected media and prompts to that service. Avoid overriding the base URL unless you fully trust it, use a dedicated output directory, prefer --no-download for testing, and review downloaded filenames and disk usage. Use a virtual environment and 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

Warning
Location
scripts/videogen.py:399
Finding

Server-Controlled Task Type Enables Output Path Traversal

Content
View full analysis

Vulnerability Details

File Location: scripts/videogen.py, lines 399-407
Vulnerability Type: Path traversal through an untrusted filename component
Risk Level: Medium

Complete Code Snippet

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

The taskType value originates from a remote API response and is incorporated directly into a local output path. No filename sanitization or resolved-path containment check is performed. A malicious or compromised API server could return a value containing absolute-path syntax, path separators, or parent-directory components such as ../.

pathlib.Path does not automatically constrain the resulting path to out_dir. Consequently, the constructed destination can escape the intended download directory.

Attack Path

  1. An attacker compromises or impersonates the configured API endpoint, or convinces the user to set --base-url or AI_HIVE_BASE_URL to an attacker-controlled service.
  2. The user submits or polls a generation task.
  3. The hostile service returns a successful task object whose taskType contains path traversal components.
  4. The script combines that value with the output directory without sanitization.
  5. download_file() opens the resulting path in write mode and writes attacker-controlled response content.
  6. An existing file at the escaped destination may be overwritten if the process has write permission.

Impact Assessment

Exploitation provides arbitrary file-write or overwrite capability within the filesystem permissions of the user running the Skill. It does not independently grant elevated operating-system privileges ...[truncated 432 chars]

Remediation
View remediation

Remediation Suggestions

  • Do not use remote response fields as filename components. Generate filenames exclusively from locally defined constants and validated identifiers.
  • If taskType must be retained, replace every character outside a strict allowlist such as [A-Za-z0-9_-].
  • Apply the same validation to task_id, because it also contributes to the filename.
  • Resolve both the output directory and candidate path, then verify that the candidate remains inside the output directory before opening it.
  • Refuse absolute paths, path separators, empty names, . components, and .. components.
  • Consider exclusive file creation or an explicit overwrite policy to prevent accidental replacement of existing output files.

Example containment strategy:

python
import re

safe_task_type = re.sub(r"[^A-Za-z0-9_-]", "_", str(task_type))
safe_task_id = re.sub(r"[^A-Za-z0-9_-]", "_", str(task_id))

base = out_dir.resolve()
candidate = (
    base / f"{safe_task_type}_{safe_task_id}_{i + 1}{ext}"
).resolve()

if base not in candidate.parents:
    raise SystemExit("Refusing output path outside the selected directory")

download_file(result_url, candidate)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/videogen.py:333
Finding

Unbounded Result Downloads Can Exhaust Local Storage

Content
View full analysis

Vulnerability Details

File Location: scripts/videogen.py, lines 333-348
Vulnerability Type: Unrestricted resource consumption during remote file download
Risk Level: Medium

Complete Code Snippet

python
def download_file(url, out_path, timeout=300):
    """Stream a file download and display progress."""
    print(f"[download] {out_path.name}")
    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)
                    if total > 0:
                        pct = int(downloaded * 100 / total)
                        bar = "█" * (pct // 5) + "░" * (20 - pct // 5)
                        print(f"\r  {bar} {pct}% ({downloaded // 1024}KB)", end="", flush=True)

Result URLs are supplied by the remote API and downloaded without a maximum permitted size. The code reads Content-Length only for progress reporting and does not reject an excessive value. If that header is missing, false, or smaller than the actual body, the running byte count is still not checked against a limit.

The request timeout does not adequately mitigate this condition. In common HTTP client behavior, the timeout controls socket inactivity rather than imposing a maximum total transfer duration or response size. A server that continuously sends data can therefore continue consuming storage.

Attack Path

  1. An attacker controls or compromises the generation API, result-storage endpoint, or configured base URL.
  2. The task response supplies an attacker-controlled resultUrl.
  3. The Skill requests that URL and starts streaming its body into a local file.
  4. The server retur ...[truncated 815 chars]
Remediation
View remediation

Remediation Suggestions

  • Define a conservative, configurable maximum result size based on supported video-generation limits.
  • Reject responses whose declared Content-Length exceeds that limit.
  • Maintain a running byte count and terminate the transfer if the actual response exceeds the limit, regardless of headers.
  • Download to a temporary file in the destination directory and atomically rename it only after successful validation.
  • Delete partial output files after network errors, validation failures, or limit violations.
  • Optionally check available disk space before beginning a large transfer.
  • Use separate connection and read timeouts and, where practical, enforce a total transfer deadline.

Example byte-limit enforcement:

python
max_bytes = 2 * 1024 * 1024 * 1024
declared = int(resp.headers.get("content-length", 0))

if declared and declared > max_bytes:
    raise SystemExit("Result exceeds the maximum permitted download size")

downloaded = 0
with open(str(out_path), "wb") as f:
    for chunk in resp.iter_content(chunk_size=8192):
        if not chunk:
            continue
        downloaded += len(chunk)
        if downloaded > max_bytes:
            f.close()
            out_path.unlink(missing_ok=True)
            raise SystemExit("Result exceeded the maximum permitted size")
        f.write(chunk)

T08 · Insecure Dependencies

Note
Location
SKILL.md:201
Finding

Dependency Installation Instructions Are Unpinned and Unverified

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 201-205
Vulnerability Type: Non-reproducible third-party dependency installation
Risk Level: Low

Complete Code Snippet

markdown
### 1. Install dependencies

```bash
pip3 install requests
text

The installation instruction resolves the latest package version made available by the user's configured Python package index. It provides no reviewed version constraint, lock file, package hash, or trusted-index guidance.

The package name `requests` is legitimate and no malicious dependency is embedded in the project. The risk arises from mutable dependency resolution and the possibility that the user has a malicious or compromised package index configured. This finding therefore represents dependency hardening weakness rather than evidence of intentional malicious code.

### Attack Path

1. The user follows the documented installation command.
2. The user's pip configuration points to a compromised, untrusted, or attacker-controlled package index, or the expected package source is compromised.
3. That source serves a malicious package artifact under the requested package name or version.
4. Pip installs the unverified artifact.
5. Malicious package code may execute during installation or when `videogen.py` imports `requests`.

### Impact Assessment

Malicious dependency code would execute with the operating-system privileges of the user running pip or the Skill. It could access that user's files, environment variables, and AI-HIVE credentials. If the user installs packages with administrative privileges, the potential scope would increase accordingly.

The audit found no evidence that the project intentionally directs users to a malicious source. Exploitation requires compromise or attacker control of dependency resolution.
Remediation
View remediation

Remediation Suggestions

  • Pin requests to a reviewed, supported version or narrowly constrained version range.
  • Provide a lock file containing transitive dependency versions.
  • Use hash verification, such as pip install --require-hashes -r requirements.txt.
  • Document the expected trusted package index and avoid unknown extra indexes.
  • Recommend installation inside a dedicated virtual environment rather than into a system Python environment.
  • Periodically update pinned dependencies after vulnerability and compatibility review.

Example hardened workflow:

bash
python3 -m venv .venv
. .venv/bin/activate
python3 -m pip install --require-hashes -r requirements.txt
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 (9)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill describes and encourages operations that can read environment/config secrets, write files, invoke shell commands, and perform network requests, yet it declares no explicit tool scope or permissions boundary. In an agent setting, this can lead to over-privileged execution where broad user prompts trigger filesystem access, API-key handling, uploads, and downloads without a clearly constrained authorization model.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The metadata explicitly sets the skill language to zh-CN, but the document does not state that users can choose another language or that the skill is limited to a China-specific compliance context. This may violate language/locale policy by imposing a specific locale without user opt-in.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

The search tags span many generic AI, ecommerce, marketing, platform, and competitor terms without meaningful constraints, making accidental or excessive invocation more likely. In a skill that interfaces with real external APIs and media uploads, this broad matching can route unrelated user intents into workflows that handle files, credentials, and billable operations.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The invocation text is broad enough to match generic AI/video workflow and competitor-comparison queries, which can cause the skill to activate outside its narrowly intended Minimax H3 use case. Over-broad triggering increases the chance that an agent routes unrelated requests into a skill that performs uploads, task submission, polling, and downloads, expanding exposure to unintended external actions.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The skill is configured for implicit invocation and its description/default prompt are broad, without clear boundaries on when it should or should not activate. Because this skill can upload user-provided media, submit generation jobs, poll task status, and download outputs through an external service, an overbroad activation scope increases the chance of unintended execution, unnecessary data transfer, or accidental use in contexts the user did not intend.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest describes a skill specifically for Minimax H3 video generation and editing workflows, but the file’s primary module docstring presents it as a general AI Hive tool for text chat, image generation, video generation, model query, media upload, and task polling. The code indeed contains generic chat/image/video commands and a separate generic CLI entrypoint, so the implementation scope is materially broader than the skill’s declared purpose.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This Python file contains user-facing natural-language strings entirely in Chinese, starting from the module docstring and continuing through CLI guidance. Because the policy requires flagging language/locale constraints that are forced without user opt-in, this is a natural-language policy violation for users who are not expecting Chinese-only interaction.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The example API key placeholder uses Chinese text ('请替换为你的APIKey'), which imposes a specific language in user-facing configuration content. There is no indication that the skill is region-specific or that users may choose another language, so this is a natural-language locale policy issue.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

The top-level docstring says the file is a '通用 AI 能力调用工具' covering text chat, image generation, and video generation, while the lower section explicitly defines fixed SKILL_CONFIG for a dedicated 'minimax-h3-video-generation-and-editing' skill and routes execution through skill_main(). This is not just incomplete documentation; it frames the file as generic when the shipped execution path is for a specific branded video skill.

Content

No source excerpt is available for this finding.