T08 · Insecure Dependencies
- Location
scripts/analyze.py:33- Finding
Automatic Installation of Unpinned Runtime Dependencies
- Content
View full analysis
Vulnerability Details
File Location:
scripts/analyze.py:33-35
Vulnerability Type: Automatic installation of mutable third-party packages
Risk Level: MediumVulnerable Code
python subprocess.check_call( [sys.executable, "-m", "pip", "install", "--quiet"] + missing, )The associated dependency declarations in
requirements.txt:1-2are also not pinned to exact versions:text pandas>=1.5.0 openpyxl>=3.0.0Technical Analysis
The script automatically invokes pip when
pandasoropenpyxlis unavailable. This installation occurs during normal script startup without explicit user confirmation or a separate trusted setup phase.The pip command requests packages by name only. The requirements file uses unrestricted minimum versions and supplies neither exact versions nor cryptographic hashes. Consequently, the packages and their transitive dependencies can change after this project has been reviewed. Package resolution may also be affected by the user's pip configuration, configured mirrors, or package indexes.
This behavior creates a supply-chain execution boundary: installation metadata, build backends, package installation logic, and subsequently imported package code may execute with the permissions of the user running the analysis script.
Attack Path
- A user runs
scripts/analyze.pyin a Python environment where one of the required modules is absent. - The startup dependency check detects the missing module.
- The script invokes
python -m pip install --quietwith the unpinned package name. - Pip resolves the package and transitive dependencies using the active package index or configured mirror.
- A compromised release, dependency, maintainer account, mirror, or build process supplies malicious code.
- Malicious installation or import-time code executes with the invoking user's privileges.
Impact Assessment
Successful exploitation co ...[truncated 568 chars]
- A user runs
- Remediation
View remediation
Remediation Suggestions
- Remove automatic package installation from application startup.
- If dependencies are missing, terminate with a clear error that directs the user to a separate installation procedure.
- Install dependencies inside a dedicated virtual environment rather than modifying the active interpreter environment.
- Pin every direct and transitive dependency to an exact reviewed version.
- Generate a lock file containing cryptographic hashes and require hash verification during installation.
- Use an explicitly trusted package index and prevent unexpected fallback to untrusted indexes or mirrors.
- Perform dependency installation as a deliberate setup step, separate from processing user workbooks.
- Add automated dependency vulnerability and provenance scanning to the release process.
