T08 · Insecure Dependencies
Warning
- Location
- requirements.txt:1
- Finding
- Unpinned dependencies are installed into the active Python environment<![CDATA[ ## Vulnerability Details **File Location**: `requirements.txt:1-2`, `install.sh:137-140` **Vulnerability Type**: Unpinned third-party dependencies and mutable supply-chain inputs **Risk Level**: Medium ### Vulnerable Code ```text requests>=2.28.0 python-dotenv>=1.0.0 ``` ```bash # 4. 安装 Python 依赖 echo "" info "安装 Python 依赖..." python3 -m pip install -r "$SCRIPT_DIR/requirements.txt" --quiet success "Python 依赖安装完成" ``` ### Technical Analysis The dependency specifications use open-ended minimum-version constraints. Consequently, each installation may retrieve a different release, including future versions that were not reviewed with this Skill. No package hashes are supplied to verify the integrity of downloaded artifacts. The installation command also uses the active `python3` environment rather than creating a dedicated virtual environment. This can modify shared user or system Python environments, depending on how Python and pip are configured. This does not establish that the named packages are currently malicious. The vulnerability is that dependency resolution remains mutable and unauthenticated at the artifact level, expanding the impact of a compromised package release, package index, mirror, or dependency account. ### Attack Path 1. An attacker compromises a permitted package release, its publisher account, or the package index/mirror used by pip. 2. The attacker publishes a malicious version satisfying `requests>=2.28.0` or `python-dotenv>=1.0.0`. 3. A user runs `install.sh`. 4. Pip resolves and downloads the malicious or compromised version because no exact version or hash restricts selection. 5. Malicious package installation or import-time code executes with the privileges of the user running the installer. 6. That code can access files and environment variables available to the user, including the Skill's stored Volcengine credentials. ### Impact Assessment Successful exploitation can execute code with the invoking user's privil ...[truncated 565 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Pin each dependency to an exact, reviewed version rather than using open-ended minimum versions: ```text requests==<reviewed-version> python-dotenv==<reviewed-version> ``` 2. Generate and verify cryptographic hashes for all packages and transitive dependencies, then install with: ```bash python3 -m pip install --require-hashes -r requirements.txt ``` 3. Create a dedicated virtual environment under a controlled Skill data directory instead of modifying the active Python environment. 4. Configure an explicit trusted package index and avoid unreviewed mirrors. 5. Add automated dependency vulnerability scanning and a controlled process for reviewing and updating pinned versions. 6. Advise users not to run the installer with elevated privileges. ]]>
