T09 · Insecure Skill Coding Practices
- Location
skill.py:314- Finding
Unsafe Evaluation of FFprobe-Derived Frame-Rate Data
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This is a coherent FFmpeg video-processing skill, but it contains unsafe code that can execute evaluated FFprobe output and it overwrites output files without clear safeguards.
Install only if you trust the publisher and can run it in a constrained workspace with media-specific input and output directories. Avoid using attacker-supplied media, subtitle paths, watermark/style values, or output paths until eval is replaced with strict numeric parsing, filter inputs are validated/escaped, and overwrite behavior requires explicit user control.
skill.py:314Unsafe Evaluation of FFprobe-Derived Frame-Rate Data
skill.py:458User-Controlled Values Injected into FFmpeg Filter Graphs
Using eval on ffprobe-derived data is dangerous because it executes the string as Python code, not just arithmetic. If an attacker can influence ffprobe output or replace/interpose a malicious ffprobe binary, this becomes arbitrary code execution in the context of the skill.
"codec": video_stream.get("codec_name") if video_stream else None,
"width": video_stream.get("width") if video_stream else None,
"height": video_stream.get("height") if video_stream else None,
"fps": eval(video_stream.get("r_frame_rate", "0/1")) if video_stream else None,
} if video_stream else None,
"audio": {
"codec": audio_stream.get("codec_name") if audio_stream else None,
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
Ubuntu/Debian:
sudo apt install ffmpeg
Windows:
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
Ubuntu/Debian:
sudo apt install ffmpeg
Windows:
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
def _check_ffmpeg(self):
"""Check if ffmpeg is installed."""
try:
subprocess.run(
["ffmpeg", "-version"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
raise RuntimeError(
"FFmpeg not found. Please install FFmpeg first:\n"
" macOS: brew install ffmpeg\n"
" Ubuntu: sudo apt install ffmpeg\n"
" Windows: winget install ffmpeg"
)
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
raise RuntimeError(
"FFmpeg not found. Please install FFmpeg first:\n"
" macOS: brew install ffmpeg\n"
" Ubuntu: sudo apt install ffmpeg\n"
" Windows: winget install ffmpeg"
)
The tool always invokes ffmpeg with '-y', forcing overwrite of existing files without prompting. In an agent or automation context, attacker-influenced output paths can cause destructive loss of local data or clobber important files accessible to the running user.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
def _run_ffmpeg(self, args):
"""Run ffmpeg command."""
cmd = ["ffmpeg", "-y"] + args
result = subprocess.run(
cmd,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
"-of", "default=noprint_wrappers=1:nokey=1",
input_file
]
result = subprocess.run(
probe_cmd,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
"-of", "default=noprint_wrappers=1:nokey=1",
input_file
]
result = subprocess.run(
probe_cmd,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
At L505 the comment says the code converts SRT to ASS for compatibility, but no conversion is actually performed; the code directly invokes the subtitles filter on the original subtitle file. The docstring at L492 also implies style override support generally, yet style is only applied in the .srt branch and is ignored for .ass/.ssa inputs.
Detected: suspicious.dynamic_code_execution