subprocess module call
- Category
- Dangerous Code Execution
- Confidence
- 95% confidence
- Finding
Running ffmpeg with an argument list and no shell is appropriate for this video-batching skill and does not itself introduce shell-command injection. However, its input list is written to a predictable shared temporary path using an open operation that follows symlinks, allowing a local attacker to cause truncation of another file writable by the process or tamper with the list before ffmpeg reads it. Additionally, filenames are interpolated into the concat format without escaping, so attacker-controlled filenames containing quotes and newlines can inject directives that include unintended local media, especially with '-safe 0'.
- Content
python "-i", concat, "-c", "copy", out] print(f"\n拼接合集:{' | '.join(os.path.basename(p) for p in finals)}") try: subprocess.run(cmd, check=True, capture_output=True, text=True) print(f"已生成合集预览:{out}") except FileNotFoundError: print("[ERROR] 未找到 ffmpeg(需置于 PATH),合集跳过", file=sys.stderr)
