T08 · Insecure Dependencies
Warning
- Location
- scripts/install_deps.sh:15
- Finding
- Unpinned Dependencies Can Modify the System Python Environment## Vulnerability Details **File Location**: `scripts/install_deps.sh`, lines 15-24 **Vulnerability Type**: Unpinned third-party dependencies and unsafe system package modification **Risk Level**: Medium ### Vulnerable Code ```bash # Try installation, including a PEP 668 bypass pip3 install numpy pandas --quiet 2>/dev/null if [ $? -ne 0 ]; then echo "Trying installation with --break-system-packages..." pip3 install --break-system-packages numpy pandas --quiet 2>/dev/null fi if [ $? -ne 0 ]; then echo "Trying a user-level installation..." pip3 install --user numpy pandas --quiet 2>/dev/null fi ``` ### Technical Analysis The installer resolves mutable package names without pinning reviewed versions or validating package hashes. It also relies on the invoking environment's pip configuration, including any configured package index or extra index. The `--break-system-packages` fallback bypasses the protections applied to externally managed Python environments under PEP 668. Consequently, the script may overwrite or introduce incompatible packages in a shared Python installation rather than isolating project dependencies. This is a supply-chain and environment-integrity weakness. It is not evidence that the currently named packages are malicious, but it leaves installation behavior dependent on mutable external artifacts and local pip configuration. ### Attack Path 1. The required modules are absent, causing the documented dependency installer to run. 2. The script invokes pip with unpinned package names. 3. Pip resolves packages through the indexes configured in the execution environment. 4. A compromised index, mirror, DNS path, or maliciously altered pip configuration supplies an unexpected distribution. 5. Package build or installation code executes with the privileges of the user running the installer. 6. If the ordinary installation fails, `--break-system-packages` permits modification of the externally managed Python environment. ### I ...[truncated 620 chars]
- Remediation
- ## Remediation Suggestions 1. Create and use a dedicated virtual environment rather than modifying the system interpreter. 2. Pin reviewed dependency versions in a lock file or requirements file. 3. Require hashes, for example through `pip install --require-hashes -r requirements.txt`. 4. Explicitly use a trusted HTTPS package index and review any configured extra indexes. 5. Remove the `--break-system-packages` fallback. 6. Prefer binary wheels from trusted sources where practical, reducing exposure to arbitrary package build steps. 7. Keep installation failures visible instead of suppressing all diagnostic output with `2>/dev/null`.
