T08 · Insecure Dependencies
- Location
requirements.txt:1- Finding
Unpinned Third-Party Dependencies Permit Unsafe Package Resolution
- Content
View full analysis
Vulnerability Details
File Location:
requirements.txt:1-4;SKILL.md:30
Vulnerability Type: Supply-chain exposure through mutable dependency versions
Risk Level: MediumVulnerable Code
requirements.txt:1-4:text tushare>=1.2.73 akshare>=1.14.0 pandas>=1.3.0 numpy>=1.21.0SKILL.md:30:bash pip install tushare pandas numpyTechnical Analysis
The dependency declarations use lower-bound constraints rather than reviewed, exact versions. They also lack cryptographic hashes. Consequently, future installations can resolve to package releases that were not part of this audit. The installation command in
SKILL.mdis even less restrictive because it specifies no versions and omitsakshare, despite the documented AKShare fallback functionality.Python packages and their transitive dependencies may execute code during installation or when imported. If an allowed future release, package repository account, distribution artifact, or transitive dependency is compromised, installation can introduce arbitrary code that is absent from the audited repository. This is a supply-chain risk rather than evidence that any currently declared package is malicious.
Attack Path
- An attacker compromises a future permitted release of
tushare,akshare,pandas,numpy, or one of their transitive dependencies. - A user follows
SKILL.mdor installs packages usingrequirements.txt. - The package resolver selects the compromised release because the project permits any version at or above the stated minimum and does not verify artifact hashes.
- Attacker-controlled code executes during package installation, package initialization, or subsequent import by the scripts.
- The malicious code operates with the permissions of the user or service running the installation and stock-analysis scripts.
Impact Assessment
Successful exploitation could provide arbitra ...[truncated 425 chars]
- An attacker compromises a future permitted release of
- Remediation
View remediation
Remediation Suggestions
- Replace lower-bound constraints with reviewed exact versions using
==. - Generate a lock file containing hashes for all direct and transitive dependencies, for example with
pip-compile --generate-hashes. - Install with hash enforcement, such as
pip install --require-hashes -r requirements.txt. - Update
SKILL.mdto install from the reviewed requirements or lock file instead of installing unrestricted package names. - Ensure the documented installation includes
akshareif fallback support remains part of the advertised functionality. - Install dependencies in an isolated virtual environment or container under a non-privileged account.
- Review, scan, and test dependency updates before regenerating approved pins and hashes.
- Replace lower-bound constraints with reviewed exact versions using
