Back to skill

Security audit

FFmpeg CLI

Security checks for vulnerabilities and agentic risk

Overview

This is a normal FFmpeg helper skill, but its scripts can overwrite files without confirmation and include unsafe input handling that users should review first.

Review this skill before installing if an agent may process untrusted filenames or choose output paths automatically. Use it only with deliberate output filenames, avoid overwriting valuable files, and avoid feeding it attacker-controlled media paths, playback rates, or watermark positions unless the scripts are hardened first.

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/merge.sh:28
Finding

FFconcat Directive Injection Through Unescaped Filenames

Content
View full analysis
> "$TEMP_LIST" done ffmpeg -f concat -safe 0 -i "$TEMP_LIST" -c copy -y "$OUTPUT" ``` ### Technical Analysis The script embeds each command-line filename directly into an FFconcat control file. Although `"$f"` is protected from shell word splitting, it is not escaped for the FFconcat syntax being generated. A filename containing a single quote, carriage return, or newline can terminate the intended `file` directive and introduce additional directives. The use of `-safe 0` also disables FFmpeg's safe-filename restrictions, increasing the range of paths that injected directives may reference. The temporary file itself is created securely with `mktemp`; however, it contains attacker-influenced control syntax rather than plain opaque data. ### Attack Path 1. An attacker obtains control over one or more filenames passed to `merge.sh`, such as through uploaded media, an automated processing queue, or an untrusted caller. 2. The attacker supplies an argument containing quote and newline characters structured as FFconcat directives. 3. The loop writes that argument into the temporary list without FFconcat-specific escaping or control-character rejection. 4. `ffmpeg` parses the injected text as additional concat-demuxer directives. 5. FFmpeg attempts to process an unintended local media file or another resource accepted by the active FFmpeg configuration. Successful exploitation depends on the injected resource being accessible and usable by FFmpeg. ### Impact Assessment The injected directives execute with the same operating-system identity and filesystem permissions as the script. This does not independently provide privilege escalation, but it may allow an attacker to: - Cause ...[truncated 475 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Note
Location
scripts/speed.sh:28
Finding

Unvalidated Playback Rate Used in FFmpeg and bc Expressions

Content
View full analysis
2.0" | bc -l) )); then FILTERS="atempo=2.0,atempo=$(echo "$RATE/2" | bc -l)" elif (( $(echo "$RATE < 0.5" | bc -l) )); then FILTERS="atempo=0.5,atempo=$(echo "$RATE*2" | bc -l)" else FILTERS="atempo=$RATE" fi ffmpeg -i "$INPUT" -filter:a "$FILTERS" -filter:v "setpts=${RATE}*PTS" -c:v libx264 -crf 23 -c:a aac -y "$OUTPUT" ``` ### Technical Analysis `RATE` is documented as a numeric value but is not validated before being embedded into two separate expression languages: - It is sent to `bc` as part of arithmetic expressions. - It is inserted into FFmpeg audio-filter and video-filter expressions. Shell quoting prevents ordinary shell command substitution from being performed on the value at this point, so this is not direct shell-command injection. However, quoting does not make the value safe for the parsers used by `bc` or FFmpeg. Unexpected operators or filter metacharacters can alter parsing, while malformed, zero, negative, non-finite, or extremely large values can cause failures or computationally expensive processing. The documentation advertises a supported range of `0.5–2.0`, but the implementation accepts arbitrary values and attempts incomplete chaining outside that range. ### Attack Path 1. An attacker controls the `-r` argument supplied to `speed.sh`. 2. The attacker submits a value containing unexpected expression syntax, filter syntax, or an extreme numeric value. 3. The script passes the value to `bc` without enforcing a decimal-only grammar. 4. The same value, or a derived value, is embedded into FFmpeg's `atempo` and `setpts` filter expressions. 5. FFmpeg may parse unintended filter syntax, reject the filter graph, generate an invalid result, or consume excessive CPU, memory, or processing time. The exact ...[truncated 736 chars]
Remediation
View remediation
&2 exit 1 fi ``` 2. Enforce the documented `0.5–2.0` range after syntactic validation: ```bash if (( $(printf '%s\n' "$RATE < 0.5 || $RATE > 2.0" | bc -l) )); then echo "Error: rate must be between 0.5 and 2.0" >&2 exit 1 fi ``` 3. Reject zero, negative, non-finite, exponential, and excessively precise values unless they are deliberately supported. 4. Construct FFmpeg filters only from the normalized numeric value, never from unrestricted caller input. 5. If rates outside `0.5–2.0` are required, implement a bounded algorithm that chains enough `atempo` filters to keep every stage within FFmpeg's accepted range. 6. Apply execution time, CPU, memory, and output-size limits when this script is exposed through an automated or multi-user service. ]]>
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (2)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The script invokes ffmpeg with the -y flag, which forces overwriting of the output path without prompting. If a user accidentally specifies an existing file, valuable data can be destroyed immediately, and in agent-driven or automated contexts this is more dangerous because the path may be constructed or passed indirectly without an interactive sanity check.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The script passes -y to ffmpeg, which forces overwriting the output file without prompting. If the caller supplies an existing path by mistake, important files can be destroyed or replaced, making this a real safety issue even though it is not code execution.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.