T08 · Insecure Dependencies
- Location
SKILL.md:18- Finding
Third-Party Dependencies Installed Without Integrity Verification
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:18-27
Vulnerability Type: Supply-chain risk from unverified package installation
Risk Level: MediumVulnerable Code
markdown ## Dependency Notes `scripts/file_reader.py` is used to read `.docx` and `.pdf` materials and depends on the following Python packages: - `python-docx==0.8.11` - `PyPDF2==3.0.1` Installation command: ```bash pip install python-docx==0.8.11 PyPDF2==3.0.1text The dependencies are subsequently imported to parse user-controlled documents in `scripts/file_reader.py:29-54`: ```python def read_docx(path: Path) -> str: try: from docx import Document except ImportError as exc: raise RuntimeError("Missing dependency: python-docx==0.8.11") from exc document = Document(str(path)) paragraphs = [p.text.strip() for p in document.paragraphs if p.text.strip()] table_lines: list[str] = [] for table in document.tables: for row in table.rows: cells = [cell.text.strip() for cell in row.cells] if any(cells): table_lines.append(" | ".join(cells)) return "\n".join(paragraphs + table_lines) def read_pdf(path: Path) -> str: try: from PyPDF2 import PdfReader except ImportError as exc: raise RuntimeError("Missing dependency: PyPDF2==3.0.1") from exc reader = PdfReader(str(path))Technical Analysis
The installation instructions retrieve packages through pip without cryptographic hashes, a reviewed lockfile, an explicitly trusted package index, or artifact-integrity verification. Version pinning improves reproducibility but does not prove that the downloaded artifacts are authentic or approved.
Exploitation requires a supply-chain precondition, such as compromise of a configured package index, a malicious private mirror, dependency substitution caused by pip configuration, or ...[truncated 1709 chars]
- Remediation
View remediation
Remediation Suggestions
- Add a reviewed requirements file containing exact versions and SHA-256 hashes for every direct and transitive dependency.
- Require hash verification during installation, for example:
bash python -m pip install --require-hashes -r requirements.txt - Generate the lock data from a controlled environment and retain reviewed artifacts or hashes in version control.
- Document the approved package index and avoid silently inheriting untrusted extra indexes or user-level pip configuration.
- Install dependencies in an isolated virtual environment under a non-administrative account.
- Establish a dependency-update process that checks vulnerability advisories, reviews release changes, regenerates hashes, and runs the test suite before adoption.
- Consider sandboxing document parsing when files may originate from untrusted users, limiting filesystem access, network access, memory, and execution time.
