Back to skill

Security audit

video-frame-extractor

Security checks for vulnerabilities and agentic risk

Overview

The skill has a clear video-frame extraction purpose, but its command templates and installer guidance could let an agent run unsafe shell commands or privileged package installs without adequate safeguards.

Review this skill before installing. It is not deceptive, but agents using it should validate paths and numeric parameters, invoke FFmpeg through structured arguments instead of shell strings, keep output inside an intended workspace, and never run the package installation commands unless you explicitly approve the system change.

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

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:50
Finding

Shell Command Injection Through Unvalidated User-Controlled Parameters

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:50-55, 74-75; SKILL-CN.md:51-56, 75-76
Vulnerability Type: OS command injection
Risk Level: High

The English and Chinese Skill documents instruct the agent to interpolate user-controlled video paths, output paths, frame rates, and scale values directly into shell commands.

Vulnerable code in SKILL.md:

bash
ffmpeg -hide_banner -loglevel error -i "{video_path}" -vf "fps={frame_rate}" -fps_mode vfr -q:v 2 -f image2 "{output_path}/%06d.jpg"
bash
ffmpeg -hide_banner -loglevel error -thread_queue_size 512 -i "{video_path}" -vf "fps={frame_rate},scale='if(gt(iw,ih),-2,{scale}):if(gt(iw,ih),{scale},-2)':flags=lanczos" -fps_mode vfr -q:v 2 -f image2 -atomic_writing 1 "{output_path}/%06d.jpg"
bash
ls {output_path}/*.jpg | wc -l
ls -lh {output_path}/*.jpg | head -5

The equivalent commands appear in SKILL-CN.md at lines 51-56 and 75-76.

Technical Analysis

The placeholders {video_path}, {output_path}, {frame_rate}, and {scale} originate from values supplied or confirmed by the user. The Skill does not require syntactic validation, canonicalization, shell-safe escaping, or execution through a structured argument array.

Quoting paths with double quotes is not a complete defense. POSIX-compatible shells still process command substitutions such as $(...) inside double-quoted strings. An embedded double quote can also terminate the intended quoted argument and expose subsequent shell metacharacters. The output verification commands are more directly exposed because {output_path} is entirely unquoted.

Numeric parameters are also inserted into the -vf argument without validation. Although FFmpeg filter syntax limits some payload forms, shell substitutions are processed by the shell before FFmpeg receives the argument. Consequently, a malicious parameter may execute a command even if it is not a valid FFmpeg value.

The ...[truncated 1851 chars]

Remediation
View remediation

Remediation Suggestions

  1. Do not execute generated command strings through a shell. Invoke FFmpeg with a process API that accepts an argument array, keeping each path and option as a separate argument.

    python
    subprocess.run(
        [
            "ffmpeg",
            "-hide_banner",
            "-loglevel", "error",
            "-i", video_path,
            "-vf", f"fps={frame_rate}",
            "-fps_mode", "vfr",
            "-q:v", "2",
            "-f", "image2",
            str(output_path / "%06d.jpg"),
        ],
        shell=False,
        check=True,
    )
    
  2. Validate numeric parameters before command construction.

    • Parse frame_rate as a finite positive decimal and enforce an appropriate upper bound.
    • Parse scale as an integer within a documented range.
    • Construct the filter expression only from parsed numeric values, not raw user input.
  3. Validate and canonicalize paths.

    • Reject NUL bytes and control characters.
    • Resolve paths against an explicitly permitted workspace.
    • Prevent output-directory traversal where extraction must remain sandboxed.
    • Confirm that the input is a permitted regular file and that the destination is a permitted directory.
  4. Replace shell verification pipelines with filesystem APIs. Enumerate JPEG files, count them, and inspect their sizes through the implementation language rather than interpolating paths into ls, wc, or head.

  5. If shell execution is unavoidable, apply platform-specific escaping to every dynamic value. This is a secondary defense and should not replace shell-free execution. Use -- before path operands where supported to prevent paths beginning with a hyphen from being interpreted as options.

  6. Update both localized Skill documents consistently. Explicitly require shell-free execution and include the same validation rules in SKILL.md and SKILL-CN.md.

  7. **Run extraction ...[truncated 208 chars]

Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (8)

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The file consistently instructs users in Chinese and does not indicate that the user can choose another language or that the skill is intentionally limited to a Chinese-speaking audience. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL-CN.md (reported line 104)May include surrounding context.

Linux(Ubuntu/Debian)

bash
sudo apt update
sudo apt install ffmpeg

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL-CN.md (reported line 105)May include surrounding context.

Linux(Ubuntu/Debian)

bash
sudo apt update
sudo apt install ffmpeg

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL-CN.md (reported line 116)May include surrounding context.

Linux(Ubuntu/Debian)

bash
sudo apt update
sudo apt install ffmpeg

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill includes package installation and command execution steps that can modify the host system, including privileged installation commands, but it does not prominently warn that these actions change system state and may require elevated privileges. In an agent setting, this increases the risk of unreviewed environment modification, especially if an automated agent follows the workflow without explicit user confirmation for installation steps.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
90% confidence
Finding

This line instructs use of sudo apt update, which executes with elevated privileges and changes system package metadata. In a skill intended for agent use, recommending privileged commands without strong approval gates can lead to unnecessary root execution and system changes on the user's machine.

Content

Scanner excerpt · SKILL.md (reported line 103)May include surrounding context.

Linux (Ubuntu/Debian)

bash
sudo apt update
sudo apt install ffmpeg

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
92% confidence
Finding

This line instructs sudo apt install ffmpeg, a privileged package installation that modifies the system and installs software from configured repositories. While common for setup documentation, embedding it in an executable agent skill creates risk if an agent performs root-level actions without explicit user consent.

Content

Scanner excerpt · SKILL.md (reported line 104)May include surrounding context.

bash
sudo apt update
sudo apt install ffmpeg

Verify Installation:

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
89% confidence
Finding

This line instructs sudo dnf install ffmpeg, which performs a privileged system-wide package installation. In the context of an agent skill, any root-level package management step is sensitive because it expands the agent's ability to alter the host environment beyond the core task of frame extraction.

Content

Scanner excerpt · SKILL.md (reported line 115)May include surrounding context.

Linux (CentOS/RHEL/Fedora)

bash
sudo dnf install ffmpeg

macOS

Static analysis

No suspicious patterns detected.