subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
# 将字幕SRT转换为ASS格式(支持样式) ass_file = output_path.replace(".mp4", ".ass") cmd = ["ffmpeg", "-y", "-i", subtitle_file, ass_file] subprocess.run(cmd, capture_output=True) # 如果视频存在,直接裁剪;否则需要先下载 if video_downloaded and Path(video_downloaded).exists():- Confidence
- 82% confidence
- Finding
- Although this is not shell injection, ffmpeg is asked to parse an attacker-influenced subtitle file produced from remote content. Media parsers have a long history of memory-safety and parser bugs, so automatically feeding untrusted files into ffmpeg creates a genuine attack surface that could lead to denial of service or, in worst cases, code execution via a vulnerable ffmpeg build.
