subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
-H "Content-Type: application/json" \ -d '{json.dumps({"prompt": prompt})}' > /tmp/cf_response.json''' subprocess.run(cmd, shell=True) with open('/tmp/cf_response.json', 'r') as f: data = json.load(f)- Confidence
- 98% confidence
- Finding
- The script builds a shell command using user-controlled prompt content and executes it with shell=True. Although json.dumps adds some escaping, single-quote shell wrapping makes this construction fragile and can permit shell command injection if crafted input breaks out of the quoted payload.
