T08 · Insecure Dependencies
- Location
scripts/setup.sh:29- Finding
Unpinned Third-Party Dependency Installed Without Integrity Verification
- Content
View full analysis
/dev/null; then echo "📦 Installing Pillow..." pip3 install Pillow fi ``` The same unsafe installation method is documented in `SKILL.md`: ```bash # Install Pillow pip3 install Pillow ``` ### Technical Analysis The setup script installs `Pillow` without specifying a reviewed version, verifying package hashes, selecting an explicit trusted package index, or using an isolated virtual environment. Consequently, the installed artifact can change over time and is affected by ambient pip configuration, including custom or compromised package indexes. The script also checks the dependency using `python3` but installs it using the separately resolved `pip3` executable. These commands are not guaranteed to refer to the same Python environment. This discrepancy can install the dependency globally or into an unintended interpreter while leaving the checked environment unchanged. Python package installation may execute package build or installation logic. If the resolved package artifact or package source is compromised, attacker-controlled code could therefore run with the privileges of the user executing the setup script. ### Attack Path 1. A user or automation agent follows the installation instructions or executes `scripts/setup.sh`. 2. The script determines that `PIL` is unavailable to `python3`. 3. It invokes `pip3 install Pillow` using the user's ambient executable search path and pip configuration. 4. `pip3` resolves an unspecified Pillow version from its configured package index without hash verification. 5. A compromised index, maliciously substituted artifact, or compromised upstream release supplies attacker-controlled package i ...[truncated 980 chars]- Remediation
View remediation
--hash=sha256: ``` 2. Require cryptographic hash verification during installation: ```bash python3 -m pip install --require-hashes -r requirements.txt ``` 3. Use `python3 -m pip` instead of a separately resolved `pip3` command so that dependency checks and installation target the same interpreter. 4. Create and use a project-specific virtual environment rather than modifying a global Python environment: ```bash python3 -m venv "$SCRIPT_DIR/.venv" "$SCRIPT_DIR/.venv/bin/python" -m pip install --require-hashes -r "$SCRIPT_DIR/requirements.txt" ``` 5. Configure an explicit trusted package index or an internally controlled package mirror, and review dependency updates before changing the pinned version or hashes. 6. Avoid automatically installing packages during normal execution. Keep dependency installation as an explicit setup operation and document the exact reviewed dependency set. ]]>
