subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
# Try direct curl first cmd = ["curl", "-L", "-o", out_path, "--max-time", "300", url] result = subprocess.run(cmd, capture_output=True, text=True, timeout=310) if os.path.exists(out_path) and os.path.getsize(out_path) > 5000: return out_path- Confidence
- 88% confidence
- Finding
- The code passes an untrusted URL from an external search result directly into curl. Even without shell=True, curl treats certain specially formatted arguments and protocols as powerful inputs, which can enable unintended local file reads, requests to internal services, or unsafe protocol handling if the upstream source is malicious.
