subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
] try: subprocess.run(cmd, check=True, capture_output=True) processed.append(str(output_file)) print(f" ✅ {filepath.name} → {output_file.name}") except subprocess.CalledProcessError as e:- Confidence
- 87% confidence
- Finding
- The script passes attacker-controlled file paths directly to ImageMagick's `convert` binary. Although `subprocess.run` is used safely without a shell, ImageMagick itself has a long history of dangerous parser/delegate behaviors, so processing untrusted images can trigger file read, SSRF, or code-execution issues in the external tool.
