subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
with open(concat_list, 'w') as f: for p in seg_paths: f.write(f"file '{p}'\n") subprocess.run( ['ffmpeg', '-y', '-f', 'concat', '-safe', '0', '-i', concat_list, '-c', 'copy', '-movflags', '+faststart', out_path], check=True, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE,- Confidence
- 82% confidence
- Finding
- The code generates an ffmpeg concat manifest using unescaped file paths and then invokes ffmpeg with '-safe 0', disabling path safety checks. If a segment path ever contains special characters such as quotes or newline characters, ffmpeg's concat parser may misparse the manifest, potentially reading unintended files or causing unsafe file handling during concatenation.
