subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
f.write(code) import subprocess result = subprocess.run( ["python", code_path], capture_output=True, text=True,- Confidence
- 99% confidence
- Finding
- The function executes dynamically generated Python code in a subprocess with the full privileges of the current user. Because the code originates from model output and incorporates untrusted paper content, an attacker can inject arbitrary Python that reads files, makes network requests, or alters the local environment, making this a real code-execution vulnerability rather than a harmless subprocess use.
