T08 · Insecure Dependencies
- Location
SKILL.md:18- Finding
Unpinned Third-Party Dependencies Create a Supply-Chain Execution Risk
- Content
View full analysis
=3.8" - packages: "tushare>=1.2.0, pandas>=1.3.0" ``` ```bash pip install tushare pandas ``` ```json "dependencies": { "python": ">=3.8", "packages": [ "tushare>=1.2.0", "pandas>=1.3.0" ] } ``` ### Technical Analysis The dependency declarations use open-ended minimum-version constraints, while the installation instructions install the latest versions available from the configured Python package index. No lock file, package hashes, exact versions, or trusted-index restrictions are provided. This is especially significant for `tushare` because the package is initialized with the sensitive `TUSHARE_TOKEN`. Imported Python packages execute module-level code with the privileges of the process. A compromised, replaced, or unexpectedly incompatible dependency could therefore access the token, local files available to the user, and the network. The audit found no evidence that the currently referenced packages are malicious. The vulnerability is the absence of controls that ensure users install the same reviewed artifacts. ### Attack Path 1. An attacker compromises a future dependency release, its publisher account, or a package index used by the victim. 2. A user follows the documented `pip install tushare pandas` command. 3. The package manager resolves a newer, unreviewed version because no exact version or hash is required. 4. Malicious installation or import-time code executes under the user account. 5. When the Skill runs, the dependency can read `TUSHARE_TOKEN`, inspect accessible local data, and initiate arbitrary network requests. ### Impact Assessment A compromised dependency could obtain arbitrary code execution with the privileges of the user running the Skill. Its scope ...[truncated 382 chars]- Remediation
View remediation
pandas== numpy== ``` 2. Generate a lock file containing cryptographic hashes, such as a hash-locked `requirements.txt`. 3. Install with hash verification: ```bash pip install --require-hashes -r requirements.txt ``` 4. Explicitly declare all direct runtime dependencies, including `numpy`, rather than relying on transitive installation. 5. Use a dedicated virtual environment with minimal filesystem and environment access. 6. Restrict installation to an approved package index and disable unintended additional indexes. 7. Review and test dependency updates before changing locked versions. 8. Avoid exposing `TUSHARE_TOKEN` to unrelated build or installation processes. ]]>
