T08 · Insecure Dependencies
- Location
requirements.txt:1- Finding
Unpinned Third-Party Dependencies Permit Unreviewed Package Updates
- Content
View full analysis
=1.2.89 pandas>=1.5.0 ``` `metadata.json:11`: ```json "packages": ["tushare>=1.2.89", "pandas>=1.5.0"] ``` `README.md:12-13`: ```text bash pip install tushare pandas ``` ### Technical Analysis The project specifies only minimum dependency versions and does not impose upper bounds, exact versions, package hashes, or a reproducible lockfile. The README further instructs users to install the packages without any version constraints. Consequently, package installation may retrieve any future version accepted by the package resolver. Python packages can execute code during installation and import. This project imports both dependencies at module initialization in `__init__.py`: ```python import pandas as pd ``` ```python import tushare as ts ``` If an allowed future release is compromised, malicious code could execute inside the skill process before normal request processing. This process may contain the user-provided `TUSHARE_TOKEN` environment variable and has the same filesystem and network privileges as the skill runtime. The finding does not establish that the currently published `tushare` or `pandas` packages are malicious. The risk arises from permitting unreviewed future releases without integrity verification. ### Attack Path 1. An attacker compromises the release process or distribution account of one of the declared packages and publishes a malicious version higher than the specified minimum. 2. A user installs the project dependencies using `pip install -r requirements.txt` or follows the README command `pip install tushare pandas`. 3. Because no exact version or hash is enforced, the resolver selects the attacker-controlled release. 4. Malicious ...[truncated 1008 chars]- Remediation
View remediation
pandas== ``` 2. Generate and commit a reproducible lockfile containing hashes for all direct and transitive dependencies. Use tooling such as `pip-compile --generate-hashes`. 3. Enforce integrity verification during installation: ```bash pip install --require-hashes -r requirements.lock ``` 4. Update `metadata.json` so its package declarations match the reviewed exact versions. 5. Replace the README command with installation from the hash-locked dependency file rather than unconstrained package names. 6. Configure package installation to use a trusted, explicitly selected package index. Avoid untrusted additional indexes that could introduce dependency-confusion risks. 7. Add automated dependency vulnerability and provenance scanning to the release process. Review and regenerate the lockfile deliberately when upgrades are required. 8. Run the skill under a least-privileged, isolated runtime with restricted filesystem access and controlled outbound networking to reduce the impact of a dependency compromise. ]]>
