Back to skill

Security audit

Seedance 参考视频生视频

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a disclosed AI Hive video-generation tool, but it needs review because it can send API keys to an arbitrary configured API host and writes downloaded output using unsanitized remote task data.

Review before installing. Use it only when you intend to upload media to AI Hive and possibly incur generation costs. Do not set --base-url, AI_HIVE_BASE_URL, or config base_url to an untrusted host, because the script will send your API key there. Prefer --no-download for tests, keep task IDs, and avoid running it on sensitive media unless you accept the third-party upload and local-output behavior.

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

API Credential Disclosure Through an Unrestricted Base URL

Content
View full analysis

Vulnerability Details

File Location: scripts/videogen.py, lines 84–96; authentication and request sink at lines 133–148
Vulnerability Type: Unvalidated destination for authenticated HTTP requests
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

The resulting URL is subsequently used with the API credential:

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 application accepts an API base URL from a command-line argument, the AI_HIVE_BASE_URL environment variable, or the local configuration file. It does not validate the URL scheme or verify that the destination belongs to an approved AI Hive host.

AiHiveClient then attaches the AI Hive API key as a bearer token to every request sent to the selected destination. Consequently, control over any base URL input is equivalent to control over the destination to which the credential is disclosed.

TLS certificate validation by requests does not prevent this issue because an attacker can operate a valid HTTPS domain with a legitimate certificate. The vulnerability does not require interception of traffic; the program intentionally sends the authorization header to the configu ...[truncated 1206 chars]

Remediation
View remediation

Remediation Suggestions

  1. Require https for authenticated endpoints and reject URLs containing user information, fragments, or unexpected ports.
  2. Use an explicit allowlist of trusted API hosts, such as the documented AI Hive hostname.
  3. Do not attach an AI Hive credential when the destination is outside the allowlist.
  4. If custom endpoints are a required feature, require explicit interactive confirmation and a separate credential intended for that endpoint.
  5. Normalize and validate the hostname before comparison, accounting for case, trailing dots, internationalized domains, and deceptive subdomains.
  6. Consider removing base URL overrides from normal production use or restricting them to a clearly marked development mode.
  7. Add tests confirming that HTTP URLs, lookalike domains, subdomains, and unapproved HTTPS hosts are rejected.

An example defensive policy is:

python
from urllib.parse import urlparse

ALLOWED_API_HOSTS = {"ai-hive.iclip.cn"}

def validate_base_url(value):
    parsed = urlparse(value)
    if parsed.scheme != "https":
        raise SystemExit("The API Base URL must use HTTPS")
    if parsed.hostname not in ALLOWED_API_HOSTS:
        raise SystemExit("The API Base URL host is not trusted")
    if parsed.username or parsed.password or parsed.fragment:
        raise SystemExit("The API Base URL contains prohibited components")
    return value.rstrip("/")

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/videogen.py:378
Finding

Path Traversal in Generated Output Filenames

Content
View full analysis

Vulnerability Details

File Location: scripts/videogen.py, lines 378–389
Vulnerability Type: Path traversal and unintended file overwrite
Risk Level: Medium

Vulnerable Code

python
# 下载结果
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)

The destination is then opened in overwrite mode 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 output filename incorporates taskType from the API response and task_id without sanitizing path separators or traversal sequences. Joining an untrusted string to out_dir with pathlib.Path does not guarantee containment.

If either value contains components such as ../, the final path can resolve outside the intended download directory. The code does not call resolve() and does not verify that the resulting path remains beneath the resolved output directory.

Because download_file() opens the path with wb, an existing file at the resulting location is truncated and replaced. Exploitation requires a malicious or compromised API endpoint, or another condition that allows crafted task metadata or identifiers to reach this code.

Attack Path

  1. A malicious or compromised API service returns a crafted taskType, or causes a crafted task identifier to be processed.
  2. The value contains path separators and traversal components.
  3. poll_task() interpolates the value directly into filename.
  4. out_dir / filename produces a path outside the intended output directory.
  5. The program ...[truncated 929 chars]
Remediation
View remediation

Remediation Suggestions

  1. Treat all API-provided identifiers and task metadata as untrusted.
  2. Generate local filenames from application-controlled values rather than directly using taskType.
  3. Restrict filename components to a conservative allowlist, such as ASCII letters, digits, underscores, and hyphens.
  4. Remove or replace /, \, .., control characters, and platform-specific reserved characters.
  5. Resolve both the output directory and candidate path, then verify containment before opening the file.
  6. Avoid silently overwriting existing files. Use exclusive creation mode or append a collision-resistant suffix.
  7. Apply the same controls to last-frame output and any future API-derived filenames.

Example containment logic:

python
import re

def safe_component(value):
    value = re.sub(r"[^A-Za-z0-9_-]", "_", str(value))
    return value[:100] or "task"

base = Path(output_dir).expanduser().resolve()
base.mkdir(parents=True, exist_ok=True)

safe_task_type = safe_component(task.get("taskType", "task"))
safe_task_id = safe_component(task_id)
candidate = (base / f"{safe_task_type}_{safe_task_id}_{i + 1}{ext}").resolve()

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

Use exclusive creation where appropriate:

python
with open(candidate, "xb") as output_file:
    ...
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • 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
Findings (13)

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The file is packaged as a Seedance reference-video-to-video skill, but the module and embedded generic client clearly implement broad AI Hive capabilities including chat, image generation, model listing, uploads, and account queries. This violates least functionality and creates capability expansion: anyone invoking or repurposing the script can access operations far beyond the declared skill scope, undermining policy controls and user expectations.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

A standalone text-chat endpoint is unrelated to the declared Seedance reference-video workflow and gives the skill a general-purpose LLM interface. That materially changes the trust boundary: the skill can be used as an unrestricted text AI client, bypassing the narrower intent, policy, and approval expectations associated with a single-purpose video generation skill.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

Standalone image generation is outside the advertised reference-video skill purpose and creates an additional content-generation primitive that reviewers and users would not expect. This is dangerous in context because the skill is marketed as a fixed Seedance r2v workflow, yet it silently contains a broader creative-generation surface that may bypass product-level restrictions or monitoring scoped to the declared use case.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The generic CLI entrypoint exposes commands such as chat, image, models, and user-info in addition to the skill-specific interface later in the file. Even though main currently calls skill_main, shipping a broadly capable parser and handlers inside the skill materially increases misuse risk through import-time reuse, alternate invocation, copy-paste reuse, or future maintenance mistakes that expose the wrong entrypoint.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding

The skill advertises and documents capabilities that read environment/config data, write files, use the network, and invoke shell commands, but it does not declare an explicit tool scope or permissions boundary. That creates a least-privilege failure: the agent may be allowed to perform broader actions than users expect, increasing the blast radius if the skill is mis-invoked, misused, or later modified.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The trigger description is heavily keyword-stuffed across broad AI video, e-commerce, advertising, and competitor-search terms, making accidental or overly broad activation likely. Over-triggering is dangerous here because activation can lead to media uploads, API-key setup, network requests, and task submission for users who may have intended only comparison, research, or general discussion.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The markdown states that user media will be automatically uploaded and outputs automatically saved/downloaded, but it does not provide a prominent privacy, consent, retention, or destination warning. This can expose sensitive videos, audio, product assets, or customer content to third-party services and local storage without the user fully understanding where data goes or what is persisted.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The applicable-user and search-intent sections define an ambiguous activation scope without clear exclusions, so the skill may match generic questions about tools, pricing, migration, e-commerce platforms, or video creation. In this skill, that ambiguity is more dangerous because invocation is tied to operational behaviors like uploading user media and saving outputs, not merely returning text guidance.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The top-level docstring advertises a generic AI capability tool rather than a narrowly scoped Seedance reference-video skill. While not exploitable by itself, this mismatch is a strong indicator that the implementation scope exceeds the manifest and can mislead reviewers, operators, and automated governance about what the skill actually enables.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The module docstring and subsequent user-facing instructional text are written entirely in Chinese, and the interactive prompts throughout the script also assume Chinese-language interaction. This imposes a language choice on users without any opt-in or documented locale constraint, which matches the policy-violation criterion for forced language/locale behavior.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

User-info and wallet-balance retrieval are unrelated to generating reference-based videos and expose account metadata to a skill that does not need it. In a skill ecosystem, unnecessary access to billing or identity information increases data exposure risk and broadens the blast radius if the skill is misused or chained with other functionality.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
96% confidence
Finding

This markdown file contains user-facing natural language entirely in Chinese across the substantive changelog entries. Under the policy, forcing a specific language without user opt-in or a documented justification is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
89% 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 offers language choice or that the locale is intentionally region-specific.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.