subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
except ImportError: print("[INFO] Installing Pillow...") import subprocess subprocess.check_call([sys.executable, "-m", "pip", "install", "Pillow", "-q"]) from PIL import Image- Confidence
- 94% confidence
- Finding
- The script invokes pip automatically at runtime via subprocess, which expands its capabilities from local image processing to package management and potential network access. This is risky because execution behavior now depends on external package indexes, local pip configuration, and the current Python environment, creating supply-chain and unexpected code-execution exposure if a malicious or substituted package is installed.
