subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
return pikepdf except ImportError: print(" pikepdf not installed, attempting to install...") subprocess.run( [sys.executable, "-m", "pip", "install", "pikepdf"], check=True, capture_output=True, )- Confidence
- 94% confidence
- Finding
- The script automatically installs `pikepdf` at runtime via pip without explicit user confirmation, which expands the tool's behavior from PDF compression into code/package installation. This creates supply-chain and unexpected-code-execution risk, especially in automated or privileged environments where package indexes, mirrors, or dependency resolution may be untrusted or manipulated.
