T08 · Insecure Dependencies
- Location
requirements.txt:6- Finding
Unpinned Dependencies Installed from a Third-Party Package Index
- Content
View full analysis
=1.40.0 # selenium>=4.15.0 # Data processing json5>=0.9.14 # Logging colorama>=0.4.6 # Async support asyncio>=3.4.3 # Progress bar tqdm>=4.66.0 # Chart generation matplotlib>=3.8.0 numpy>=1.24.0 ``` The installation script resolves these dependencies through a third-party mirror: ```python requirements_path = Path(__file__).parent.parent / 'requirements.txt' if requirements_path.exists(): run_command( f"{sys.executable} -m pip install -r {requirements_path} " f"-i https://pypi.tuna.tsinghua.edu.cn/simple", "Install Python dependencies" ) ``` ### Technical Analysis Every dependency uses a lower-bound version constraint rather than an exact, reviewed version. No lockfile or cryptographic package hashes are provided. Consequently, the effective code installed by the project can change after the project itself has been audited. The installer also explicitly trusts a third-party Python package index. If the mirror, an upstream package release, or a transitive dependency is compromised, `pip` may retrieve and install attacker-controlled code. Python package installation can execute build backends and other package-supplied code in the context of the user running the installer. This is not evidence that the listed packages are currently malicious. The vulnerability is the absence of controls that ensure future installations reproduce a reviewed dependency set. ### Attack Path 1. An attacker compromises a permitted package release, a transitive dependency, or the configured package mirror. 2. The attacker publishes a version satisfying one of the open-ended `>=` constraints. 3. A user runs `python scripts/install.py` or manually inst ...[truncated 1105 chars]- Remediation
View remediation
json5== colorama== tqdm== matplotlib== numpy== ``` 2. Generate and commit a lockfile that includes all transitive dependencies. 3. Use cryptographic hashes and install with `pip --require-hashes`. 4. Prefer the official Python package index or an organization-controlled mirror that synchronizes and verifies upstream artifacts. 5. Review and pin Playwright browser artifacts as part of the release process. 6. Install inside an isolated virtual environment under a non-administrative account. 7. Remove the unnecessary `asyncio` package dependency on supported Python versions, because `asyncio` is part of the standard library. 8. Add automated dependency vulnerability and provenance scanning to the release process. ]]>
