T09 · Insecure Skill Coding Practices
- Location
skill.py:319- Finding
Unsafe Evaluation of Media Metadata May Enable Arbitrary Python Code Execution
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This is a coherent local FFmpeg video tool, but it needs review because one metadata path can evaluate untrusted-looking ffprobe output as Python code and the tool overwrites outputs by default.
Install only if you are comfortable with a local FFmpeg wrapper that reads and writes chosen media paths. Avoid running the info command on untrusted media until the eval() frame-rate parsing is replaced with safe numeric parsing, and choose output paths carefully because existing files can be overwritten.
skill.py:319Unsafe Evaluation of Media Metadata May Enable Arbitrary Python Code Execution
Using eval on ffprobe output is dangerous because it executes arbitrary Python expressions, not just numeric frame-rate math. If an attacker can influence the parsed metadata or the ffprobe output source, this can lead to arbitrary code execution in the context of the running process.
"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,
The document forces a specific language/locale for user-facing instructions, and the file does not indicate any user opt-in, alternative language option, or region-specific requirement. This matches the policy-violation criterion for language or locale constraints imposed without choice or justification.
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 helper unconditionally prepends FFmpeg's -y flag, causing existing output files to be overwritten in all video-processing operations. Although the code has internal docstrings, there is no user-facing confirmation prompt or visible warning in CLI help/output that these commands will replace files on disk.
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,
This markdown file documents multiple operations that create or modify user files, including cutting, converting, compressing, and frame extraction, but it does not warn users that output paths will be written to disk and may overwrite existing files or consume storage. Under the markdown-specific missing-warning criterion, user-facing documentation should disclose behaviors that affect user data or system state.
The extract_frames flow automatically creates the output directory and then writes a sequence of image files into it. While this behavior is part of the feature, the code provides no user-facing disclosure that it will create directories and generate potentially large numbers of files.
The comment at L505 says the code will convert SRT subtitles to ASS for better compatibility, and L506 creates an ass_file path, but no conversion step ever occurs and ass_file is never used. The actual behavior is to pass the original subtitle file directly to FFmpeg's subtitles filter.
Detected: suspicious.dynamic_code_execution