Back to skill

Security audit

Shinewilzhang Video Generate

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent video-generation helper, but it can send arbitrary local files to a remote service as a first-frame image and can overwrite user-writable files without safeguards.

Install only if you trust the prompts and agents that will invoke it. Use a dedicated output directory, avoid absolute paths, do not pass sensitive local files as the first-frame input, and treat any local first-frame file as being uploaded to the remote video service.

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

Unrestricted Local File Encoding and Transmission

Content
View full analysis

Vulnerability Details

File Location: scripts/video_generate.py, lines 33-43 and 72-79
Vulnerability Type: Arbitrary local file disclosure through insufficient input validation
Risk Level: Medium

Vulnerable Code

python
if os.path.isfile(image_input):
    try:
        mime_type, _ = mimetypes.guess_type(image_input)
        if not mime_type:
            # Fallback or default
            mime_type = "image/png"

        with open(image_input, "rb") as image_file:
            encoded_string = base64.b64encode(image_file.read()).decode("utf-8")
            return f"data:{mime_type};base64,{encoded_string}"
    except Exception as e:
        print(f"Failed to read or encode image file {image_input}: {e}")
        return None
return image_input

The resulting data is subsequently submitted to the remote Ark service:

python
if first_frame_image:
    image_url_or_base64 = get_image_content(first_frame_image)
    if image_url_or_base64:
        content.append(
            {"type": "image_url", "image_url": {"url": image_url_or_base64}}
        )

Technical Analysis

The first-frame argument can refer to any file readable by the process. The code does not restrict the file to an approved workspace, validate its binary signature, enforce an image MIME-type allowlist, reject symbolic links, or impose a maximum size.

If MIME-type detection fails, the file is labeled as image/png regardless of its actual contents. The complete file is then read into memory, Base64-encoded, embedded in a data URI, and included in a request submitted through the Ark client.

Base64 encoding is consistent with the documented first-frame image feature and is not, by itself, evidence of a covert exfiltration channel. However, the missing validation means that credentials, configuration files, private keys, or other non-image data can be transmitted using the same channel. This exceeds the minimum local-file access needed to upload a legitimate ...[truncated 1612 chars]

Remediation
View remediation

Remediation Suggestions

  1. Resolve the supplied path to its canonical form and require it to remain under an explicitly approved input directory.
  2. Reject path traversal, unexpected absolute paths, and symbolic links where symlink support is not required.
  3. Permit only necessary image formats, such as PNG, JPEG, or WebP.
  4. Validate the actual file signature with a trusted image parser rather than relying only on the extension returned by mimetypes.guess_type().
  5. Remove the fallback that labels arbitrary files as image/png; reject unknown or unsupported content instead.
  6. Enforce a conservative maximum file size before opening the file and use bounded or streaming reads where supported.
  7. Decode and validate the image to ensure it is structurally valid before transmission.
  8. Clearly notify the user that the selected local file will be sent to a remote service and require explicit confirmation for local-file uploads.
  9. Avoid including local paths or file content in error messages and logs beyond what is operationally necessary.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/video_generate.py:102
Finding

Arbitrary Writable-Path File Overwrite

Content
View full analysis

Vulnerability Details

File Location: scripts/video_generate.py, lines 102-110 and 143-149
Vulnerability Type: Unrestricted output path and unsafe file overwrite
Risk Level: Medium

Vulnerable Code

The download destination is used without path confinement or an overwrite check:

python
# Create directory if needed (based on filename path)
dirname = os.path.dirname(filename)
if dirname and not os.path.exists(dirname):
    os.makedirs(dirname, exist_ok=True)

print(f"Downloading video to {filename}...")
urllib.request.urlretrieve(video_url, filename)
print(f"Downloaded to: {filename}")

The destination originates directly from the command-line argument:

python
if len(sys.argv) < 3:
    print(
        "Usage: python video_generate.py <filename> <prompt> [first_frame_image_path_or_url]"
    )
    sys.exit(1)

filename = sys.argv[1]
prompt = sys.argv[2]
first_frame_image = sys.argv[3] if len(sys.argv) > 3 else None

video_generate(filename, prompt, first_frame_image)

Technical Analysis

The user-controlled filename is passed directly to urllib.request.urlretrieve(). Absolute paths, traversal sequences, existing files, and destinations outside the intended output workspace are not rejected.

The script also creates missing parent directories with os.makedirs(). When the destination already exists, urlretrieve() can replace it without requesting confirmation. Consequently, the operation has access to the full writable filesystem scope of the account running the Skill rather than only the directory needed for generated videos.

The downloaded object is expected to originate from the Ark-generated video URL, so the code does not demonstrate arbitrary attacker-selected URL download behavior. The confirmed issue is unrestricted destination selection and overwrite, not remote payload execution.

Attack Path

  1. An attacker, untrusted prompt, or unsafe automation causes the calling agent to supply an absolute p ...[truncated 1258 chars]
Remediation
View remediation

Remediation Suggestions

  1. Define a dedicated output directory and resolve all destinations relative to that directory.
  2. Canonicalize the resulting path and verify that it remains beneath the approved output root.
  3. Reject absolute paths, traversal components, symbolic-link destinations, and non-regular output targets.
  4. Restrict output names to safe basename characters and require an approved video extension such as .mp4.
  5. Open output files using exclusive-create semantics so existing files are not overwritten by default.
  6. Require explicit user authorization when overwrite support is genuinely necessary.
  7. Write to a securely created temporary file in the approved directory, validate the downloaded content type and size, and atomically rename it to the final destination.
  8. Apply a maximum download size and reasonable network timeouts to reduce storage and availability risks.
  9. Run the Skill under a minimally privileged account that cannot modify sensitive system or application files.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (4)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding

The skill advertises behavior that uses environment-derived credentials and network access, but it does not declare any tool scope or permissions boundaries. This can cause an agent or user to invoke a capability-rich skill without clear consent or sandbox expectations, increasing the chance of unintended secret access or outbound requests.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

The natural-language instructions throughout the file are presented exclusively in Chinese, which can amount to a language policy violation when no user opt-in or locale justification is provided. The document does not indicate that the skill is region-specific or offer an alternative language.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The skill allows a first-frame image to be provided via HTTP URL without warning that this triggers an outbound request to a third party. Remote hosts may learn request metadata such as IP address, timing, and user-agent information, and the fetched content may be untrusted.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

The documentation states that the generated video will be automatically downloaded to the specified path, but it does not warn about local filesystem writes, path safety, or overwrite behavior. This can lead to accidental replacement of existing files or writes to sensitive locations if an unsafe path is supplied.

Content

No source excerpt is available for this finding.