Back to skill

Security audit

AI Video Upscale

Security checks for vulnerabilities and agentic risk

Overview

This video upscaling skill has a coherent purpose, but its shell script and install steps create review-worthy local execution and supply-chain risks.

Install only if you are comfortable running third-party native video tools locally. Before use, fix or avoid the job_id trap issue, restrict activation to explicit video requests, and verify downloaded Real-ESRGAN and Waifu2x archives with trusted hashes or signatures.

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 (2)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/upscale_video.sh:134
Finding
Command Injection Through an Unsafe EXIT Trap<![CDATA[ ## Vulnerability Details **File Location**: `scripts/upscale_video.sh`, lines 14–19 and 134–135 **Vulnerability Type**: Shell command injection through dynamically constructed trap code **Risk Level**: High ### Vulnerable Code ```bash JOB_ID="${6:-}" # optional job ID # Generate job ID if not provided if [ -z "$JOB_ID" ]; then JOB_ID="job_$(date +%s)_$RANDOM" fi ``` ```bash TEMP_DIR=$(mktemp -d "/tmp/openclaw-upscale-${JOB_ID}-XXXXXX") trap "rm -rf $TEMP_DIR" EXIT ``` ### Technical Analysis The optional `JOB_ID` parameter is controlled by the caller and is embedded in the temporary-directory template without validation. Quoting the argument passed to `mktemp` prevents immediate shell expansion, but it does not make the resulting filename safe for later use as shell source. The generated path is interpolated into a double-quoted `trap` command. The trap body is parsed again by the shell when the script exits. Consequently, shell metacharacters contained in the directory name—such as semicolons or comment characters—can alter the trap command and introduce additional commands. This behavior is unnecessary for video upscaling and violates the principle that untrusted values must never be incorporated into dynamically evaluated shell code. ### Attack Path 1. An attacker or untrusted caller invokes the script with a malicious sixth argument, for example a `JOB_ID` containing syntax equivalent to: ```text x;id;# ``` 2. `mktemp` creates a directory whose path contains those characters because the supplied template is passed as one quoted filesystem argument. 3. The resulting path is inserted into the trap body: ```bash trap "rm -rf $TEMP_DIR" EXIT ``` 4. When the script exits normally or because of an error, Bash reparses the expanded trap body. 5. The semicolon terminates the intended `rm` command, the injected command executes, and the comment character suppresses the remaining generated filename suffix. 6. An attacker can r ...[truncated 615 chars]
Remediation
<![CDATA[ ## Remediation Suggestions Do not construct trap handlers as strings containing expanded, caller-influenced values. Define a cleanup function and let it reference the variable when executed: ```bash TEMP_DIR="" cleanup() { if [ -n "${TEMP_DIR:-}" ] && [ -d "$TEMP_DIR" ]; then rm -rf -- "$TEMP_DIR" fi } trap cleanup EXIT TEMP_DIR=$(mktemp -d "/tmp/openclaw-upscale-XXXXXXXX") ``` Additionally: 1. Do not include `JOB_ID` in the temporary-directory template unless operationally necessary. 2. If it must be included, enforce a strict allowlist before use: ```bash case "$JOB_ID" in (*[!A-Za-z0-9._-]*|'') error_exit "Invalid job ID" ;; esac ``` 3. Use `rm -rf -- "$TEMP_DIR"` so the path remains one quoted argument and cannot be interpreted as an option. 4. Keep the temporary path under a fixed trusted parent and verify that it is nonempty before deletion. 5. Add regression tests using job IDs containing semicolons, spaces, quotes, command substitutions, newlines, and option-like strings. ]]>

T08 · Insecure Dependencies

Warning
Location
references/INSTALL.md:13
Finding
Downloaded Native Executables Are Not Integrity-Verified<![CDATA[ ## Vulnerability Details **File Location**: `references/INSTALL.md`, lines 13–18 and 22–28 **Vulnerability Type**: Unverified third-party binary dependencies **Risk Level**: Medium ### Vulnerable Code ```bash mkdir -p ~/video-tools/waifu2x-ncnn-vulkan cd ~/video-tools/waifu2x-ncnn-vulkan curl -L -o waifu2x.zip "https://github.com/nihui/waifu2x-ncnn-vulkan/releases/download/20220728/waifu2x-ncnn-vulkan-20220728-ubuntu.zip" unzip waifu2x.zip # Rename folder to: waifu2x-ncnn-vulkan-20220728-ubuntu ``` ```bash mkdir -p ~/video-tools/real-video-enhancer cd ~/video-tools/real-video-enhancer curl -L -o realesrgan.zip "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.5.0/realesrgan-ncnn-vulkan-20220424-ubuntu.zip" unzip realesrgan.zip chmod +x realesrgan-ncnn-vulkan ``` ### Technical Analysis The installation guide retrieves archives containing native executables over HTTPS and extracts them without verifying a cryptographic digest or signature. The runtime script subsequently invokes `waifu2x-ncnn-vulkan` or `realesrgan-ncnn-vulkan`. The URLs are version-specific GitHub release URLs associated with projects matching the declared functionality; the reviewed files do not establish that they are personal paste sites, typographical impersonations, or intentionally malicious sources. Nevertheless, HTTPS only authenticates the transport endpoint. It does not independently prove that the downloaded release asset is the exact artifact reviewed or expected by the Skill. A compromised upstream account, replaced release asset, repository compromise, or unsafe local substitution could therefore result in arbitrary native code being installed and executed. ### Attack Path 1. An attacker compromises an upstream release account, repository, release artifact, or another part of the binary distribution chain. 2. The archive available at the documented URL is replaced with a modified archive containing a malicious executable. 3. A user follows the install ...[truncated 1017 chars]
Remediation
<![CDATA[ ## Remediation Suggestions Pin and verify each downloaded artifact before extraction or execution: ```bash curl --fail --show-error --location \ --output waifu2x.zip \ "https://github.com/nihui/waifu2x-ncnn-vulkan/releases/download/20220728/waifu2x-ncnn-vulkan-20220728-ubuntu.zip" printf '%s %s\n' 'TRUSTED_SHA256_VALUE' 'waifu2x.zip' | sha256sum --check - ``` Apply equivalent verification to the Real-ESRGAN archive. In addition: 1. Obtain expected hashes from an independently authenticated source and document them directly in the reviewed installation instructions. 2. Prefer upstream cryptographic signatures when available and verify them against a pinned maintainer key. 3. Use `curl --fail --show-error --location` so HTTP failures do not silently produce invalid archive files. 4. Download into a newly created private temporary directory. 5. Inspect archive paths before extraction and reject absolute paths, parent-directory traversal entries, links, or unexpected executable files. 6. Extract with restrictive permissions and grant execute permission only after successful verification. 7. Update version pins and hashes through a reviewed release process rather than following mutable “latest” URLs. 8. Where practical, use a trusted operating-system package or reproducible build process instead of precompiled third-party archives. ]]>
Vulnerability Patterns
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (5)

Vague Triggers

High
Confidence
96% confidence
Finding
The manifest trigger phrases are broad, generic terms like "upscale," "enhance," and "improve quality" that can match many ordinary user requests without clearly constraining invocation to video-processing contexts. This increases the chance of accidental or inappropriate activation, which could cause the agent to route unrelated content or files into an external media-processing workflow unexpectedly.

Vague Triggers

Medium
Confidence
90% confidence
Finding
The example prompts reinforce ambiguous activation behavior by using short, generic phrases like "Upscale this" and "Make this 4K" without clarifying that the target must be a video input. In isolation these phrases are common conversational requests, so they can contribute to over-triggering and accidental invocation of the skill.

Vague Triggers

Medium
Confidence
97% confidence
Finding
The trigger list includes generic phrases such as "upscale," "enhance," and "improve quality," which can match many ordinary user requests outside the narrow intent of video upscaling. This raises the chance of unintended skill invocation, causing the agent to route unrelated prompts into a tool that may consume resources, mishandle user intent, or produce unsafe side effects in the wrong context.

Session Persistence

Medium
Category
Rogue Agent
Content
### Waifu2x (recommended for anime)
```bash
mkdir -p ~/video-tools/waifu2x-ncnn-vulkan
cd ~/video-tools/waifu2x-ncnn-vulkan
curl -L -o waifu2x.zip "https://github.com/nihui/waifu2x-ncnn-vulkan/releases/download/20220728/waifu2x-ncnn-vulkan-20220728-ubuntu.zip"
unzip waifu2x.zip
Confidence
60% confidence
Finding
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Session Persistence

Medium
Category
Rogue Agent
Content
Set these to point to your tool locations:

```bash
# Add to ~/.bashrc or ~/.zshrc
export VIDEO_UPSCALE_REALESRGAN="$HOME/video-tools/real-video-enhancer"
export VIDEO_UPSCALE_WAIFU2X="$HOME/video-tools/waifu2x-ncnn-vulkan/waifu2x-ncnn-vulkan-20220728-ubuntu"
export VIDEO_UPSCALE_CACHE="$HOME/.openclaw/cache/video-upscale"
Confidence
90% confidence
Finding
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Static analysis

No suspicious patterns detected.