Back to skill

Security audit

video-generate

Security checks for vulnerabilities and agentic risk

Overview

This video-generation skill is mostly purpose-aligned, but it has risky credential-handling instructions that could persist API keys in plaintext workspace files.

Review before installing. Use a dedicated low-privilege video API key, configure it through a secret manager or protected runtime environment, and do not let the agent append keys to workspace files. Avoid submitting sensitive prompts, private media, signed URLs, or internal URLs because they are sent to the configured external API.

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/video_generate.py:11
Finding

Configurable API Endpoint Can Exfiltrate Bearer Credentials

Content
View full analysis

Vulnerability Details

File Location: scripts/video_generate.py, lines 11–18, 52–55, and 166–181
Vulnerability Type: Unvalidated authentication endpoint configuration
Risk Level: High

Vulnerable Code

python
API_KEY = (
    os.getenv("ARK_API_KEY")
    or os.getenv("MODEL_VIDEO_API_KEY")
    or os.getenv("MODEL_AGENT_API_KEY")
)
API_BASE = os.getenv(
    "MODEL_VIDEO_API_BASE", "https://ark.cn-beijing.volces.com/api/v3"
).rstrip("/")
python
def _get_headers() -> dict:
    return {
        "Content-Type": "application/json",
        "Authorization": f"Bearer {API_KEY}",
    }
python
async def _create_video_task(
    prompt: str, config: VideoGenerationConfig, model_name: str
) -> dict:
    url = f"{API_BASE}/contents/generations/tasks"
    body = _build_request_body(prompt, config, model_name)

    async with httpx.AsyncClient(timeout=60.0) as client:
        response = await client.post(url, headers=_get_headers(), json=body)
        response.raise_for_status()
        return response.json()


async def _get_task_status(task_id: str) -> dict:
    url = f"{API_BASE}/contents/generations/tasks/{task_id}"

    async with httpx.AsyncClient(timeout=60.0) as client:
        response = await client.get(url, headers=_get_headers())
        response.raise_for_status()
        return response.json()

Technical Analysis

MODEL_VIDEO_API_BASE controls the destination of authenticated HTTP requests without validation of its scheme or hostname. Both task-creation and task-status requests attach the selected API key as a bearer token.

An attacker who can influence the process environment can set this variable to an attacker-controlled endpoint. The script will then transmit the bearer credential, prompts, task identifiers, and supplied reference-media URLs to that endpoint. Accepting MODEL_AGENT_API_KEY as a fallback increases the potential imp ...[truncated 1369 chars]

Remediation
View remediation

Remediation Suggestions

  • Restrict API requests to an explicit allowlist of approved HTTPS origins, preferably the official service hostname.
  • Parse the configured URL and reject non-HTTPS schemes, embedded credentials, unexpected ports, fragments, and unapproved hostnames.
  • Disable automatic redirects or validate the destination of every redirect before forwarding authorization headers.
  • Do not use MODEL_AGENT_API_KEY as a fallback. Require a dedicated, least-privilege video-generation credential.
  • Separate credentials by service and environment, with narrowly scoped permissions and rotation support.
  • Fail closed when endpoint validation fails and avoid including secrets in exception messages or logs.
  • Protect deployment and environment configuration from modification by untrusted users.

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:189
Finding

Documentation Directs Automatic Plaintext Persistence of API Keys

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, line 189
Vulnerability Type: Insecure secret storage instruction
Risk Level: Medium

Vulnerable Instruction

text
- IF the script raises the error "PermissionError: ARK_API_KEY or MODEL_VIDEO_API_KEY or MODEL_AGENT_API_KEY not found in environment variables", inform the user that they need to provide the `ARK_API_KEY` or `MODEL_VIDEO_API_KEY` or `MODEL_AGENT_API_KEY` environment variable. Write it to the environment variable file in the workspace. If the file already exists, append it to the end. Ensure the environment variable format is correct, make the environment variable effective, and retry the video generation task that just failed.

Technical Analysis

The Skill instructs the Agent to persist a supplied API key in an unspecified environment-variable file inside the workspace. It does not require explicit user consent for filesystem persistence, define a protected filename, enforce restrictive permissions, ensure exclusion from version control, or prevent duplicate and stale entries.

Blindly appending secrets can leave multiple active or historical credentials in plaintext. A workspace may be shared, backed up, archived, attached to support requests, or committed to source control, causing the credential to outlive the generation operation and become accessible outside its intended scope.

Attack Path

  1. Video generation is invoked without a configured API key.
  2. The script raises the documented missing-key error.
  3. Following SKILL.md, the Agent asks the user for a key.
  4. The Agent writes or appends the key to an environment file in the workspace.
  5. The file has weak permissions, is included in source control, is shared with another user, or is collected by backups or workspace-export tooling.
  6. An unauthorized party reads the plaintext credential.
  7. The party uses the key for API requests within its granted permission and billi ...[truncated 434 chars]
Remediation
View remediation

Remediation Suggestions

  • Remove the instruction to write credentials automatically into the workspace.
  • Direct users to a platform secret manager or protected runtime environment configuration.
  • Require a dedicated video-service key instead of accepting a general agent credential.
  • If local persistence is unavoidable, obtain explicit informed user consent before writing the secret.
  • Use a fixed filename that is excluded from version control and workspace exports.
  • Create the file with owner-only permissions, such as mode 0600, and verify ownership before use.
  • Replace the relevant variable safely rather than blindly appending duplicate values.
  • Never display the key in logs or responses, and provide documented rotation and deletion procedures.
  • Add repository safeguards such as .gitignore rules and secret-scanning hooks.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (7)

Missing User Warnings

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The documentation directs automatic handling of API keys and retry behavior without warning the user about plaintext storage or long-term retention risks. This can cause users to disclose secrets under the assumption they are used transiently, while the system silently persists them and expands the blast radius of compromise.

Content

No source excerpt is available for this finding.

Ssd 3

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

Persisting API keys in workspace environment files exposes secrets in plain text and may leave them accessible to other processes, future sessions, collaborators, or unrelated skills. The instruction to automatically retry after making the variable effective normalizes unsafe secret handling and turns a transient missing-secret condition into durable credential exposure.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill declares no explicit tool scope even though its documented behavior requires environment-variable access and network use. Missing scope restrictions weakens least-privilege controls and can allow the agent to use broader capabilities than reviewers or users would expect.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill instructs the agent to write API credentials into a workspace environment file and make them effective, which persists secrets beyond the immediate task. Storing user-provided keys in workspace files creates unnecessary credential retention and increases the chance of later disclosure through file access, logs, backups, or other skills.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill sends user prompts and referenced media URLs to an external video-generation service, which can expose sensitive user data, internal URLs, or proprietary media if the user is not clearly informed. In an agent-skill context this is more significant because users may assume inputs stay local, while referenced URLs may also reveal private infrastructure locations or signed resource links.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The file reads ARK_API_KEY, MODEL_VIDEO_API_KEY, or MODEL_AGENT_API_KEY from the environment and uses the resulting bearer token for outbound requests. There is no nearby comment, docstring, or user-facing explanation that the script consumes these credentials and authenticates against an external service.

Content

No source excerpt is available for this finding.

Dynamic attribute access via getattr()

Low
Category
Dangerous Code Execution
Confidence
50% confidence
Finding

Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.

Content

Scanner excerpt · scripts/video_generate.py (reported line 157)May include surrounding context.

python
"watermark",
    ]
    for field_name in optional_fields:
        value = getattr(config, field_name, None)
        if value is not None:
            body[field_name] = value

Static analysis

No suspicious patterns detected.