subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
_req_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "requirements.txt") if os.path.exists(_req_file): print("[*] 检测到缺少 requests 库,正在通过 requirements.txt 安装(SHA256 hash 校验)...") subprocess.run( [sys.executable, "-m", "pip", "install", "-r", _req_file, "--require-hashes", "-q"], check=True, )- Confidence
- 91% confidence
- Finding
- The script automatically invokes pip to install dependencies at runtime via a subprocess. Even though it uses a local requirements.txt and --require-hashes, executing package installation as part of normal tool operation expands the attack surface, can trigger unintended code execution through package install hooks, and is inappropriate for a downloader script handling untrusted environments.
