Back to skill

Security audit

AI ASMR商品视频|AI-HIVE

Security checks for vulnerabilities and agentic risk

Overview

The skill largely matches an AI-HIVE product-video workflow, but it handles API keys, uploads, downloads, and paid generation with under-scoped endpoint and file-output safeguards.

Review before installing. Use this only if you trust AI-HIVE, keep the API key limited and rotatable, avoid custom base URLs or AI_HIVE_BASE_URL unless you fully trust the HTTPS endpoint, inspect ~/.ai-hive/config.json before use, confirm before paid generation or uploads, and use a dedicated output directory for downloaded media.

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/videogen.py:94
Finding

API Credential Disclosure Through an Unrestricted Base URL

Content
View full analysis

Vulnerability Details

File Location: scripts/videogen.py:94-99, 126-143
Vulnerability Type: Unrestricted authenticated endpoint configuration
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 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 value is accepted without validating its scheme, hostname, port, or trust relationship with AI-HIVE.

Every request made through _request attaches the AI-HIVE bearer credential in the Authorization header. Consequently, if an attacker can influence any base URL configuration source, authenticated requests are redirected to the attacker’s server and disclose the API key. The implementation also does not require HTTPS, so credentials may be transmitted over plaintext HTTP.

Attack Path

  1. An attacker influences the execution environment, command invocation, or ~/.ai-hive/config.json.
  2. The attacker sets AI_HIVE_BASE_URL or --base-url to an atta ...[truncated 883 chars]
Remediation
View remediation

Remediation Suggestions

  1. Restrict authenticated API requests to an explicit allowlist of approved AI-HIVE HTTPS hostnames.
  2. Parse URLs with urllib.parse.urlparse and reject:
    • Schemes other than https
    • Embedded usernames or passwords
    • Unexpected hostnames or ports
    • Loopback, private, link-local, and other non-approved network destinations
  3. Do not attach an AI-HIVE credential to arbitrary custom endpoints. If custom endpoints are a required feature, use a separate credential explicitly supplied for that endpoint.
  4. Disable cross-origin redirects or validate every redirect destination before forwarding the Authorization header.
  5. Require explicit interactive confirmation when changing the configured service endpoint.
  6. Store the expected endpoint origin alongside the credential and refuse to use that credential for a different origin.
  7. Add automated tests proving that HTTP endpoints, unapproved hosts, and cross-origin redirects are rejected.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/videogen.py:278
Finding

Unvalidated Server-Controlled Media Destinations and Output Paths

Content
View full analysis

Vulnerability Details

File Location: scripts/videogen.py:278-290, 316-326, 396-408
Vulnerability Type: Untrusted URL handling and output-path construction
Risk Level: Medium

Vulnerable Code

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

# PUT 到 OSS — 不携带 API Key,使用返回的 headers
print(f"[2/3] 上传文件到对象存储...")
with open(str(path), "rb") as f:
    try:
        oss_resp = requests.request(
            upload_method, upload_url, headers=upload_headers,
            data=f, timeout=300,
        )
python
def download_file(url, out_path, timeout=300):
    """流式下载文件,带进度条显示。"""
    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)
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)

# 尾帧
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)

Technical Analysis

Media upload URLs, upload methods, upload headers, result URLs, last-frame URLs, and task metadata are accepted directly from API responses. The code does not validate URL schem ...[truncated 2193 chars]

Remediation
View remediation

Remediation Suggestions

  1. Validate upload and download URLs using a strict allowlist of provider-controlled HTTPS hosts.
  2. Reject plaintext HTTP, embedded credentials, unsupported schemes, unexpected ports, and loopback, private, link-local, or metadata-service addresses.
  3. Restrict upload methods to the exact methods expected by the provider, such as PUT, and permit only documented upload headers.
  4. Disable redirects or validate every redirect target before sending file contents or accepting a download.
  5. Sanitize taskType, task_id, and other filename components to a conservative character set such as letters, digits, underscores, and hyphens.
  6. Remove path components with Path(value).name and generate local filenames independently of server-provided values where possible.
  7. Resolve the output directory and final output path, then verify containment before opening the file:
    python
    output_root = Path(output_dir).expanduser().resolve()
    final_path = (output_root / safe_filename).resolve()
    if output_root not in final_path.parents:
        raise SystemExit("Unsafe output path")
    
  8. Use exclusive file creation or explicit overwrite confirmation to prevent unintended replacement of existing files.
  9. Apply maximum download-size limits and verify expected content types before committing downloaded files.
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 (13)

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The declared description promises a fairly full-featured AI ASMR video creation skill, including domain-specific input handling and external AI-HIVE generation workflow operations. The supplied code only creates a local JSON brief from a handful of command-line arguments and fixed metadata. While a production brief is loosely related to the domain, the implementation covers only a small preparatory subset and omits the core advertised behaviors and integrations. This is a material description/behavior mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared description focuses on an AI-assisted ASMR/product advertising video creation workflow, including creative planning and optional external API-driven asset generation. The supplied code does none of that. It is a narrow, auditable wrapper around ffmpeg/ffprobe for simple local editing operations. While video editing could be a supporting component of a larger ASMR video pipeline, this chunk’s actual primary purpose is generic media manipulation, not AI ASMR content generation or API orchestration. That is a material description-behavior mismatch.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill advertises and demonstrates code paths that use environment variables, local files, network access, and shell/ffmpeg, but it does not declare any explicit tool scope or permissions boundaries. This is dangerous because agents may execute these operations with broader privileges than intended, increasing the risk of unintended file access, secret exposure, network exfiltration, or unsafe command execution in downstream environments.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The default prompt hard-codes Chinese output ('production-ready Chinese workflow') without indicating that this is contingent on user preference or locale. This can override user expectations, reduce transparency, and in multilingual environments may cause misunderstanding of generated steps or commands, especially where operational instructions or cost-sensitive API actions are involved.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The manifest enables implicit invocation (allow_implicit_invocation: true) without any visible activation guardrails, narrowing conditions, or consent checks. In a skill that can generate runnable AI-HIVE commands and production workflows, this increases the chance the agent will invoke the skill in contexts the user did not explicitly intend, causing unintended API use, cost-incurring actions, or workflow generation beyond user expectations.

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

The file is documented and implemented as a general-purpose AI Hive client, while the skill metadata presents a narrowly scoped ASMR product-video generator. This capability expansion violates least-privilege expectations for skills and increases attack surface by exposing unrelated API operations that callers may invoke unexpectedly.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The module documentation explicitly describes a universal AI capability tool, contradicting the narrow skill identity in metadata. This mismatch is dangerous because reviewers and users may approve the skill based on its stated ASMR purpose while the code exposes materially 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 nearly all user-facing prompts are written only in Chinese, presenting the skill as a general-purpose tool rather than a region-specific or Chinese-only skill. Under the language/locale policy, forcing a specific language without user opt-in or documented justification is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The generic text chat command is unrelated to the declared ASMR product-video purpose and allows arbitrary prompt forwarding to external models. That broadens the skill from a constrained media workflow into a general AI proxy, which can be abused for unintended content generation, data handling, or policy bypass through a mislabeled skill.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

Standalone image generation exceeds the declared function of a product-video skill and introduces another unrelated generation surface. This makes the skill a broader content-generation gateway than advertised, increasing misuse risk and undermining trust in skill-scoped permissions.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The file's natural-language description and embedded skill name use Chinese-specific labeling ('AI ASMR商品视频|AI-HIVE') as the only presented locale, and the default platform value is also Chinese ('待确认'). Because there is no user choice or documented justification for a Chinese-only locale, this is a natural-language locale policy concern under the stated rules.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

Exposing a user-info endpoint in a skill meant for product-video generation grants unnecessary access to account and wallet data. Even if read-only, this can leak sensitive operational or billing information to users or wrappers that should only be able to generate media.

Content

No source excerpt is available for this finding.