T08 · Insecure Dependencies
Warning
- Location
- scripts/requirements.txt:1
- Finding
- Unpinned Third-Party Dependencies Permit Unreviewed Package Releases<![CDATA[ ## Vulnerability Details **File Location**: `scripts/requirements.txt:1-5`; installation instruction at `SKILL.md:18-21` **Vulnerability Type**: Software supply-chain risk caused by unrestricted dependency resolution **Risk Level**: Medium ### Vulnerable Code `scripts/requirements.txt:1-5`: ```text httpx>=0.24.0 requests>=2.28.0 opencc-python-reimplemented>=0.1.7 beautifulsoup4>=4.12.0 lxml>=5.0.0 ``` `SKILL.md:18-21`: ```bash cd <skill_dir> pip install -r scripts/requirements.txt ``` ### Technical Analysis Every dependency is specified using only a minimum version constraint. There is no upper bound, exact version pin, lock file, or package hash verification. Consequently, package resolution can install releases that did not exist when the Skill was reviewed. The installation instructions also invoke `pip` directly without requiring an isolated virtual environment or hash verification. Python packages may execute build backend logic during installation, while installed packages execute code when imported by the Skill. If an allowed package or one of its transitive dependencies is compromised, a malicious release may therefore run code with the privileges of the user installing or invoking the Skill. This finding does not establish that the currently named packages are malicious. It identifies an unsafe dependency-resolution policy that permits future, compromised, or otherwise unreviewed releases to enter the execution environment. ### Attack Path 1. An attacker compromises the distribution account, source repository, build pipeline, or transitive dependency of a package permitted by `scripts/requirements.txt`. 2. The attacker publishes a malicious release with a version satisfying the applicable `>=` constraint. 3. A user follows the documented command: ```bash pip install -r scripts/requirements.txt ``` 4. The package resolver selects the malicious release because no exact version or trusted hash is specified. 5. Malicious code e ...[truncated 858 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace lower-bound constraints with exact, reviewed versions: ```text httpx==<reviewed-version> requests==<reviewed-version> opencc-python-reimplemented==<reviewed-version> beautifulsoup4==<reviewed-version> lxml==<reviewed-version> ``` 2. Generate a lock file that includes all transitive dependencies and cryptographic hashes. Install it with hash enforcement: ```bash python3 -m pip install --require-hashes -r requirements.lock ``` 3. Perform installation in a dedicated virtual environment: ```bash python3 -m venv .venv . .venv/bin/activate python3 -m pip install --require-hashes -r requirements.lock ``` 4. Configure pip to use an approved package index and disable unintended extra indexes to reduce dependency-confusion exposure. 5. Add automated dependency review, vulnerability scanning, and controlled lock-file update procedures. Review release notes and package provenance before changing pinned versions. 6. Explicitly warn users not to install the dependencies with `sudo` or into a privileged system Python environment. ]]>
