subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
""" ] result = subprocess.run(cmd, capture_output=True, text=True) return result.returncode == 0- Confidence
- 98% confidence
- Finding
- The script builds Python code with f-string interpolation of input_file and output_file and passes it to `python -c`. A filename containing quotes or Python syntax can break out of the string literal and execute arbitrary Python code in the spawned interpreter, leading to code execution under the current user.
