Back to skill

Security audit

AI Video Gen

Security checks for vulnerabilities and agentic risk

Overview

This video-generation skill is mostly purpose-aligned, but it has a real endpoint-configuration flaw and under-scoped external media upload behavior that users should review before installing.

Review this skill before installing. It will send video prompts and any provided frame/image data to Doubao/Volcengine, may upload generated videos to Feishu, and writes MP4 files locally. The current script should be fixed to read VIDEO_GEN_BASE_URL from the correct environment variable and should validate download URLs before use. Avoid supplying sensitive images, prompts, or credentials unless you trust the configured provider endpoints and have confirmed the upload destination.

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 (1)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/generate_video.py:14
Finding

API Key Environment Variable Incorrectly Used as the API Base URL

Content
View full analysis

Vulnerability Details

File Location: scripts/generate_video.py, lines 14-15
Vulnerability Type: Endpoint confusion caused by incorrect secret/configuration variable use
Risk Level: Medium

Vulnerable Code

python
API_KEY = os.environ.get("VIDEO_GEN_API_KEY", "")
BASE_URL = os.environ.get("VIDEO_GEN_API_KEY", "https://ark.cn-beijing.volces.com/api/v3")

Technical Analysis

BASE_URL is populated from VIDEO_GEN_API_KEY rather than the documented VIDEO_GEN_BASE_URL variable. When VIDEO_GEN_API_KEY is configured, the same value is consequently used both as bearer authentication material and as the request URL prefix.

Subsequent requests construct their destinations from this incorrect value:

python
url = f"{BASE_URL}/video/generations"

In a normal configuration, an API key is not a valid URL, so video-generation requests fail. If the value is URL-shaped, however, prompts and selected image data can be transmitted to that URL instead of the intended Volcengine endpoint. Base64 image data may therefore be exposed to an unintended server.

This does not, by itself, demonstrate theft of a valid Volcengine credential: a URL-shaped value used to redirect the request is also the value placed in the authorization header. Nevertheless, it creates an endpoint-confusion flaw, ignores the documented base URL setting, and can cause unauthorized disclosure of submitted prompts or media.

The legitimate network access and Base64 encoding are necessary for the declared remote image-to-video functionality. The vulnerability is the incorrect association between secret and endpoint configuration, not the encoding operation itself.

Attack Path

  1. An attacker or compromised deployment configuration supplies a URL-shaped value in VIDEO_GEN_API_KEY, such as https://attacker.example.
  2. At module initialization, both API_KEY and BASE_URL receive that value.
  3. The user invokes the scrip ...[truncated 1421 chars]
Remediation
View remediation

Remediation Suggestions

Read the endpoint from the correct environment variable:

python
API_KEY = os.environ.get("VIDEO_GEN_API_KEY", "")
BASE_URL = os.environ.get(
    "VIDEO_GEN_BASE_URL",
    "https://ark.cn-beijing.volces.com/api/v3",
).rstrip("/")

Apply the following additional hardening:

  1. Parse the configured endpoint with urllib.parse.urlparse.
  2. Require the https scheme.
  3. Restrict the hostname to the expected Volcengine domain unless custom endpoints are an explicit requirement.
  4. Reject URLs containing user information, fragments, or unexpected query parameters.
  5. Keep authentication secrets and endpoint configuration in separate variables and never derive one from the other.
  6. Add startup validation that reports configuration errors without printing secret values.
  7. Add tests confirming that VIDEO_GEN_API_KEY affects only the authorization header and VIDEO_GEN_BASE_URL affects only the destination.
  8. Clearly warn users that prompts and selected media are transmitted to the configured remote provider.
  9. Consider limiting Base64 input size before reading an entire local image into memory and sending it over the network.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (14)

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
80% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · references/api.md (reported line 10)May include surrounding context.

md
- **创建任务**: `POST /video/generations`
- **查询任务**: `GET /video/generations/{task_id}`
- **任务列表**: `GET /video/generations`
- **取消/删除**: `DELETE /video/generations/{task_id}`

## 请求参数

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
96% confidence
Finding

The skill documents use of environment variables and outbound network access, but it does not declare any tool scope or allowed-tools constraints. This creates a permission-boundary problem: the agent may invoke code, access secrets, and transmit data externally without an explicit, reviewable declaration of those capabilities.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The trigger description is broad enough to match common user requests like 'generate a video' or 'make a video,' which can cause unintended activation. In this skill, accidental invocation is more dangerous because activation can lead to external API calls, credential use, and media upload workflows.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
83% confidence
Finding

整个技能说明与触发描述均固定为中文,且未说明是否支持根据用户偏好切换语言,也没有提供语言/区域选择机制。按规则,若技能强制特定语言而没有用户 opt-in,属于自然语言层面的策略问题。

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill describes sending media to external services and using credentials, but it does not warn users that prompts, images, audio, generated videos, and tokens may be transmitted off-platform. This is dangerous because users may unknowingly expose sensitive data or authorize uploads to third-party systems without informed consent.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
90% confidence
Finding

This duplicate finding points to the same authentication request and remains security-relevant because it transmits credentials to an external service. In context, the issue is not that Feishu auth is inherently malicious, but that the skill exposes secret-using network behavior without explicit capability declarations or clear consent boundaries.

Content

Scanner excerpt · SKILL.md (reported line 109)May include surrounding context.

md
import requests

# 获取 token(使用飞书 app_id 和 app_secret)
resp = requests.post(
    "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal",
    json={"app_id": "YOUR_APP_ID", "app_secret": "YOUR_APP_SECRET"}
)

External Transmission

Medium
Category
Data Exfiltration
Confidence
90% confidence
Finding

This duplicate finding points to the same authentication request and remains security-relevant because it transmits credentials to an external service. In context, the issue is not that Feishu auth is inherently malicious, but that the skill exposes secret-using network behavior without explicit capability declarations or clear consent boundaries.

Content

Scanner excerpt · SKILL.md (reported line 109)May include surrounding context.

md
import requests

# 获取 token(使用飞书 app_id 和 app_secret)
resp = requests.post(
    "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal",
    json={"app_id": "YOUR_APP_ID", "app_secret": "YOUR_APP_SECRET"}
)

External Transmission

Medium
Category
Data Exfiltration
Confidence
97% confidence
Finding

This request uploads a video file to Feishu, which is a clear external data exfiltration path. The risk is elevated because the skill workflow encourages sending generated media outward without requiring explicit user acknowledgment of what content is being uploaded or where it will be stored.

Content

Scanner excerpt · SKILL.md (reported line 117)May include surrounding context.

md
# 上传视频
with open("video.mp4", "rb") as f:
    resp = requests.post(
        "https://open.feishu.cn/open-apis/im/v1/files",
        headers={"Authorization": f"Bearer {token}"},
        files={"file": ("video.mp4", f, "video/mp4")},

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

In image_to_video_base64 mode, a local file path is opened, encoded, and later included in the request payload sent to the remote service. The code comments describe the mechanics for developers, but there is no user-facing warning in the CLI or docstring that local file contents may be uploaded off-system.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This code sends the user's prompt and potentially first/last/reference frame content to a remote HTTP endpoint via client.post(...). Although the script logs that it is creating a task, it does not clearly disclose to the user that their content will be uploaded to a third-party service, which is the kind of network transmission warning required for code files.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The download function fetches any URL passed to it and writes the response to disk without validating that the URL belongs to the expected Doubao/Volcengine service or even uses an allowed scheme/host. If an attacker can influence the API response or the video_url field, this can be abused for arbitrary outbound requests and untrusted content retrieval, expanding the skill beyond its stated purpose and creating SSRF-like and unsafe-download behavior.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

This markdown file presents all user-facing instructions and API documentation exclusively in Chinese. Under the policy for natural-language violations, forcing a specific language without user opt-in or a documented regional justification can be a locale policy issue.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
77% confidence
Finding

The manifest describes AI video generation and editing, but this script goes beyond task creation by fetching the returned video URL and saving the content to a local file. Local file output may be an implementation choice, but it is still behavior not stated in the description itself.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

This function saves remote content to disk, either to a provided output path or a generated filename in the current working directory. While it logs the destination after writing, the CLI and top-level documentation do not warn beforehand that running the script will create or overwrite a local file.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.