subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
if gen.load_data(data_path): result = gen.generate(output_path) import subprocess subprocess.Popen(["start", "", str(result)], shell=True) print(f"\n[DONE] {result}")- Confidence
- 98% confidence
- Finding
- The script launches the generated report using subprocess.Popen with shell=True and a command derived from a runtime-controlled path. Even though result is intended to be a local file path, using the shell to open it introduces command-injection risk if an attacker can influence the output filename or path, and it also causes unintended code execution behavior on the host.
