T08 · Insecure Dependencies
Warning
- Location
- install.sh:11
- Finding
- Unpinned Dependencies Installed from the Active Python Package Index## Vulnerability Details **File Location**: `install.sh`, line 11 **Vulnerability Type**: Insecure third-party dependency installation **Risk Level**: Medium ### Vulnerable Code ```bash pip install flake8 bandit 2>/dev/null && echo " ✅ flake8 + bandit 已安装" || echo " ⚠️ 部分安装失败,可手动: pip install flake8 bandit" ``` ### Technical Analysis The installer retrieves and installs `flake8`, `bandit`, and their transitive dependencies without pinning versions or verifying package hashes. It also relies on the invoking environment's active package index and pip configuration. Consequently, the exact code installed can change after the Skill has been reviewed. Python package installation may execute package build or installation logic with the privileges of the user running `install.sh`. A compromised package release, dependency, configured package index, or dependency-resolution path could therefore introduce attacker-controlled code. Redirecting standard error to `/dev/null` conceals diagnostic and security-relevant installation messages, making unexpected index behavior, certificate problems, build failures, and dependency conflicts harder to investigate. ### Attack Path 1. An attacker compromises an upstream package, one of its transitive dependencies, or a package index selected through the user's pip configuration. 2. The attacker publishes a malicious version that remains compatible with the unbounded dependency request. 3. A user runs `bash install.sh`. 4. Pip resolves and downloads the attacker-controlled release. 5. Malicious build or installation logic executes with the invoking user's privileges. 6. The installed package can subsequently execute again when imported or invoked. This is a supply-chain exposure rather than evidence that the currently named packages are malicious. ### Impact Assessment Successful exploitation could execute arbitrary code under the account running the installer. That code could access files and credentials available to th ...[truncated 520 chars]
- Remediation
- ## Remediation Suggestions 1. Pin every direct dependency to a reviewed version: ```text flake8==REVIEWED_VERSION bandit==REVIEWED_VERSION ``` 2. Generate a locked dependency file containing all transitive dependencies and cryptographic hashes. 3. Install with hash enforcement: ```bash python3 -m pip install \ --require-hashes \ --only-binary=:all: \ -r requirements-audit.txt ``` 4. Explicitly select the trusted package index rather than implicitly accepting environment-controlled pip configuration where deployment policy permits. 5. Install into a dedicated virtual environment with no administrative privileges. 6. Review and periodically update pinned dependencies through a controlled process. 7. Do not discard standard error. Preserve installation diagnostics and fail clearly if dependency installation is unsuccessful. 8. Consider making these tools optional because the current `scripts/audit.py` implementation does not invoke either dependency.
