T08 · Insecure Dependencies
Warning
- Location
- requirements.txt:1
- Finding
- Incorrect and Unpinned Runtime Dependencies## Vulnerability Details **File Location**: `requirements.txt:1-3` **Vulnerability Type**: Supply-chain risk from ambiguous, incorrect, and unpinned dependencies **Risk Level**: Medium ### Vulnerable Code ```text bs4 dataclasses fitz ``` ### Technical Analysis The dependency manifest does not reliably identify the distributions expected by the source code and documentation: - The code imports `fitz` as the PyMuPDF API, but the manifest requests the distribution named `fitz` rather than `PyMuPDF`. - The documentation identifies `beautifulsoup4` as a dependency, while the manifest uses the indirect `bs4` package name. - `dataclasses` is normally part of the Python standard library on supported modern Python versions and should not be installed unless legacy Python compatibility explicitly requires the backport. - None of the dependencies have reviewed version constraints, hashes, or a lock file. Python packages can execute installation-time code with the privileges of the account running `pip`. Ambiguous package identities and unrestricted version resolution therefore expose users to package substitution, incompatible releases, compromised future releases, and non-reproducible environments. ### Attack Path 1. A user follows the documented setup procedure and runs `pip install -r requirements.txt`. 2. The package index resolves the literal, ambiguous package names and selects unrestricted versions. 3. The selected distributions and their transitive dependencies are downloaded. 4. Any installation hooks or build backends supplied by those distributions execute under the user's account. 5. If an unintended or compromised distribution is resolved, it can run arbitrary code during installation, before the Skill itself is invoked. Exploitation depends on dependency resolution selecting an unintended or compromised package; no malicious package payload is embedded in this repository. ### Impact Assessment Succe ...[truncated 422 chars]
- Remediation
- ## Remediation Suggestions 1. Replace ambiguous package names with the distributions actually required by the source: - Use `PyMuPDF` for the `fitz` import. - Use `beautifulsoup4` directly instead of the `bs4` shim. 2. Remove `dataclasses` unless the project intentionally supports a Python version that requires the backport. 3. Pin every direct and transitive dependency to a reviewed version through a lock file. 4. Generate and verify cryptographic hashes, such as by using `pip --require-hashes`. 5. Define and enforce a supported Python version so unnecessary compatibility packages cannot enter the environment. 6. Audit locked dependencies for known vulnerabilities and review changes before updating them. 7. Install dependencies in an isolated, least-privileged virtual environment or container rather than under an administrative account. A corrected direct-dependency manifest should begin with reviewed versions of the intended distributions, for example: ```text beautifulsoup4==<reviewed-version> PyMuPDF==<reviewed-version> ```
