Back to skill

Security audit

Seedance 视频延长

Security checks for vulnerabilities and agentic risk

Overview

The skill appears intended for AI video extension, but it needs review because its activation scope is too broad and its API/download handling can expose credentials or write files unexpectedly.

Install only if you are comfortable sending prompts, videos, images, and audio to AI Hive and storing an API key locally. Avoid using custom base URLs unless you fully trust the endpoint, and prefer running the skill only for explicit video-extension tasks with non-sensitive media. Review output locations because generated files are downloaded automatically by default.

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

Warning
Location
scripts/videogen.py:397
Finding

Untrusted API Response Fields Allow Output Path Traversal

Content
View full analysis

Vulnerability Details

File Location: scripts/videogen.py:397-414
Vulnerability Type: Path traversal and arbitrary file write
Risk Level: Medium

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

The code constructs output paths using taskType and taskId without validating or sanitizing either value. These identifiers can originate from API responses, particularly when a generation request returns its taskId and a subsequent polling response supplies taskType.

If either value contains an absolute path or traversal components such as ../, the expression out_dir / filename does not guarantee that the resulting file remains beneath out_dir. For example, an absolute taskType can cause pathlib to discard the preceding output directory. Traversal components can similarly resolve outside that directory.

The destination is then passed to download_file(), which opens it in write mode:

python
with open(str(out_path), "wb") as f:

Existing files at a resolved destination can therefore be truncated and replaced. Exploitation requires control of, or the ability to compromise, the configured API endpoint or its responses.

Attack Path

  1. An attacker controls or compromises the API server used by the client. This can also occur if the user is induced to configure an attacker-controlled --base-url.
  2. The malicious server ...[truncated 1069 chars]
Remediation
View remediation

Remediation Suggestions

  • Validate taskId and taskType against a strict allowlist, such as ^[A-Za-z0-9_-]+$.

  • Do not use server-provided descriptive fields directly in local filenames. Prefer locally generated identifiers, such as a UUID.

  • Resolve and verify every destination before opening it:

    python
    out_dir = Path(output_dir).expanduser().resolve()
    out_dir.mkdir(parents=True, exist_ok=True)
    
    safe_task_type = sanitize_identifier(task.get("taskType", "task"))
    safe_task_id = sanitize_identifier(task_id)
    destination = (
        out_dir / f"{safe_task_type}_{safe_task_id}_{i + 1}{ext}"
    ).resolve()
    
    if destination.parent != out_dir:
        raise SystemExit("Unsafe output path returned by API")
    
  • Use exclusive creation mode ("xb") when overwriting existing files is unnecessary.

  • Consider assigning fixed local extensions and filenames independently of all remote metadata.

  • Add tests covering absolute paths, ../ traversal, path separators, empty identifiers, and platform-specific path syntax.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/videogen.py:91
Finding

Bearer API Key Can Be Sent to an Insecure or Untrusted Base URL

Content
View full analysis

Vulnerability Details

File Location: scripts/videogen.py:91-100, 130-143
Vulnerability Type: Sensitive credential exposure through unrestricted endpoint configuration
Risk Level: Medium

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
        )

The unrestricted endpoint is also exposed through the command-line interface:

python
parser.add_argument("--base-url", help=f"API Base URL (默认 {DEFAULT_BASE_URL})")

Technical Analysis

The Base URL can be supplied through a command-line argument, an environment variable, or the persistent configuration file. The value is accepted without validating its scheme or hostname.

Every request made through _request() includes the API bearer token. Consequently, a Base URL using plain HTTP transmits the credential without transport encryption, while an attacker-controlled HTTPS endpoint receives the credential directly despite valid TLS protection.

Although custom API endpoints may be an intentional feature, automatically attaching a production bearer token to an arbitrary endpoint creates a credential-d ...[truncated 1310 chars]

Remediation
View remediation

Remediation Suggestions

  • Require https:// for all remote Base URLs and reject cleartext HTTP.
  • Restrict authenticated requests to an explicit allowlist of trusted hostnames by default, including the official AI Hive host.
  • If custom endpoints are required for development, require an explicit option such as --allow-custom-base-url and display the exact destination before transmitting credentials.
  • Use a separate development credential for custom endpoints rather than automatically reusing the production key.
  • Parse URLs with urllib.parse.urlsplit() and validate the normalized scheme, hostname, port, username, and password fields.
  • Reject embedded credentials, ambiguous hostnames, unexpected ports, and malformed URLs.
  • Consider ignoring AI_HIVE_BASE_URL in privileged or unattended environments unless custom endpoint use has been explicitly enabled.
  • Document that changing the Base URL changes the party receiving the API key.
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)

Vague Triggers

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The metadata description contains extremely broad trigger terms spanning many unrelated brands, marketplaces, and generic product-comparison intents. This can cause the agent to invoke the skill in contexts where the user did not ask to upload media, use an external API, or run local automation, increasing the chance of unintended data transfer or surprising actions.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding

The skill describes capabilities that can read environment/config secrets, write files, invoke shell commands, and access the network, but it does not declare any explicit tool scope or permission boundaries. In an agent environment, this creates excessive implicit authority: the skill can be selected and operate with broad access without clear least-privilege constraints or user awareness.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The skill is written almost entirely in Chinese while also targeting English-speaking users via English trigger terms, but it does not state that Chinese is required or offer a language preference option. This can violate language/locale policy by implicitly forcing a language without user opt-in.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill does not clearly warn that prompts and uploaded media are transmitted to an external service and that outputs are automatically downloaded to local storage. This undermines informed consent and can expose sensitive videos, creative assets, or confidential prompts to third parties and create unexpected local files on the user's machine.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The guidance says the skill is appropriate for a wide range of search, comparison, migration, and e-commerce intents without clear boundaries. In context, this is risky because the skill can upload user media, save task identifiers, poll external services, and download files locally, so overbroad routing materially raises the chance of unnecessary third-party disclosure and unintended side effects.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The file is packaged as a Seedance video-extension skill, but it embeds a generic AI Hive client and CLI supporting chat, image generation, model listing, uploads, and other operations outside the declared purpose. In a skill ecosystem, this expands the callable capability surface beyond user expectations and policy scope, enabling unintended actions if the script is invoked directly or repurposed by surrounding tooling.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The module docstring and user-facing guidance are written only in Chinese, and the interactive prompts throughout the script likewise assume Chinese-language operation. This creates a natural-language policy concern because the skill effectively fixes the interaction language without offering the user a language choice or documenting a justified locale restriction.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

A video-extension skill should not include a user-info capability that retrieves account details and wallet/balance information. This creates unnecessary access to potentially sensitive account metadata and enables information disclosure beyond the stated function of extending videos.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The generic text-chat pathway is unrelated to Seedance video extension and materially broadens what the skill can do with the provided API key. In a constrained skill context, extra model-invocation primitives are dangerous because they can be abused for off-purpose data processing or hidden prompt execution workflows not disclosed by the skill interface.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Image-generation support is outside the declared scope of a Seedance video-extension skill and increases the available action surface tied to the same API credentials. This weakens least-privilege assumptions and allows the skill to perform unrelated billable or data-processing operations if misused.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

The file presents all substantive release notes in Chinese, with no indication that users can choose another language or that the skill is region-specific. Under the policy, forcing a specific language without user opt-in is a natural-language locale violation.

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 value includes Chinese text (请替换为你的APIKey), which embeds a specific language choice in user-facing configuration content. There is no indication that the skill offers language choice or that the locale is intentionally constrained for a region-specific tool.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The module docstring states this is a '通用 AI 能力调用工具' covering text chat, image generation, video generation, model querying, media upload, and task polling. That directly conflicts with the skill’s manifest identity and bottom-level fixed configuration for Seedance video extension, creating active documentation/code intent divergence within the packaged skill.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.