T08 · Insecure Dependencies
- Location
scripts/run.sh:20- Finding
Automatic Installation of Unpinned and Unverified Dependencies
- Content
View full analysis
=9.0.0 ``` ### Technical Analysis On the first invocation, `run.sh` creates a virtual environment and automatically downloads and installs the latest available `pip` and any Pillow release satisfying `>=9.0.0`. Neither exact versions nor cryptographic hashes are specified. This means the code ultimately installed and executed is not fully represented by the audited project. Future, unreviewed package versions can enter the execution path without a source-code change. Python package installation may execute package build hooks or other installation-time code, so a compromised package release, package repository, mirror, DNS/network path, or distribution artifact could result in arbitrary code execution. No evidence indicates that Pillow or pip is currently malicious. The vulnerability is the absence of deterministic dependency pinning and integrity verification combined with automatic installation during normal execution. ### Attack Path 1. A user invokes `scripts/run.sh` on a system where the project’s `.venv` directory does not exist. 2. The script creates the virtual environment and executes `pip install --upgrade pip`. 3. It then processes `requirements.txt`, whose `Pillow>=9.0.0` constraint permits any current or future matching Pillow version. 4. An attacker who has compromised an eligible upstream release, package index, configured mirror, or relevant network delivery path supplies a malicious distribution artifact. 5. Pip downloads and installs that ...[truncated 758 chars]- Remediation
View remediation
``` 2. Generate a lock file containing cryptographic hashes for every permitted distribution and install with hash enforcement: ```bash python -m pip install --require-hashes -r requirements.lock ``` 3. Remove `pip install --upgrade pip` from routine skill execution. Pin and provision a reviewed pip version during a separate setup or build phase. 4. Separate dependency installation from normal GIF generation. Make network access and package installation an explicit, user-approved setup operation. 5. Prefer a trusted internal package mirror or prebuilt, verified environment where appropriate. 6. Regularly review and update pinned versions through a controlled dependency-update process that includes vulnerability scanning and integrity-lock regeneration. ]]>
