T08 · Insecure Dependencies
Warning
- Location
- requirements.txt:1
- Finding
- Unbounded Third-Party Dependency Installation## Vulnerability Details **File Location**: `requirements.txt:1-2`, `README.md:19`, `SKILL.md:18`, `SKILL.md:258`, `demo_project/README.md:9` **Vulnerability Type**: Unpinned and automatically upgraded third-party dependencies **Risk Level**: Medium ### Vulnerable Code `requirements.txt:1-2` ```text akshare>=1.0.0 pandas>=1.5.0 ``` `README.md:19` and `SKILL.md:18` ```bash pip install akshare --upgrade ``` `SKILL.md:258` ```python import mplfinance as mpf # pip install mplfinance ``` `demo_project/README.md:9` ```bash pip install -r ../requirements.txt ``` ### Technical Analysis The dependency constraints specify only minimum versions, allowing pip to install any later release of `akshare` or `pandas`. The documented `--upgrade` command explicitly requests the newest available AKShare release, and the optional `mplfinance` installation instruction does not specify a reviewed version. Python packages and their transitive dependencies can execute code during build and installation processes and when imported at runtime. Because dependency versions and artifact hashes are not fixed, the code ultimately installed can differ from what was reviewed. A compromised upstream account, malicious package release, compromised transitive dependency, or package-index incident could therefore introduce attacker-controlled code into the environment. This is a supply-chain weakness rather than evidence that the currently named packages are malicious. ### Attack Path 1. An attacker compromises an upstream package, one of its transitive dependencies, or its package-distribution account. 2. The attacker publishes a malicious version that still satisfies the lower-bound constraints, or publishes it as the newest version selected by `--upgrade`. 3. A user follows the documented installation instructions or installs `requirements.txt`. 4. Pip resolves and downloads the attacker-controlled release because n ...[truncated 927 chars]
- Remediation
- ## Remediation Suggestions 1. Replace minimum-version constraints with exact, reviewed versions: ```text akshare==<reviewed-version> pandas==<reviewed-version> mplfinance==<reviewed-version> ``` 2. Generate a lock file that includes all transitive dependencies rather than pinning only direct dependencies. 3. Record and enforce package hashes, for example by using: ```bash python -m pip install --require-hashes -r requirements.txt ``` 4. Remove `--upgrade` from routine installation instructions. Perform upgrades only through a controlled dependency-review process. 5. Install dependencies from the official package index or an authenticated internal mirror with provenance and integrity controls. 6. Scan proposed dependency updates for known vulnerabilities and review unexpected changes to transitive dependencies. 7. Perform installation and execution in an isolated virtual environment or container under a non-privileged account. 8. Keep build environments free of unnecessary credentials and restrict outbound network access where operationally feasible.
