T08 · Insecure Dependencies
Note
- Location
- pyproject.toml:6
- Finding
- Unpinned Pillow Dependency Creates Mutable Supply-Chain Exposure## Vulnerability Details **File Location**: `pyproject.toml:6-8`, `scripts/print.py:2-5`, `SETUP.md:23-26` **Vulnerability Type**: Unlocked third-party dependency **Risk Level**: Low ### Vulnerable Code `pyproject.toml:6-8`: ```toml dependencies = [ "pillow>=10.0.0", ] ``` `scripts/print.py:2-5`: ```python # /// script # requires-python = ">=3.10" # dependencies = ["Pillow"] # /// ``` `SETUP.md:23-26`: ```bash # Verify setup python3 {baseDir}/scripts/print.py list # Install Pillow (only needed for image printing) pip install Pillow ``` ### Technical Analysis The project declares Pillow inconsistently and without a reproducible dependency lock: - `pyproject.toml` accepts every Pillow release at or above version 10.0.0. - The inline script metadata permits any version of Pillow. - The setup documentation instructs users to install the latest version available from pip. - No lock file, integrity hash, or index restriction is supplied. Consequently, two installations performed at different times can execute different dependency code even though the audited project files have not changed. This does not establish that the current Pillow package is malicious; the exposure arises because future or otherwise substituted artifacts are trusted without version and integrity verification. ### Attack Path 1. An attacker compromises an eligible future Pillow release, its distribution account, the configured package index, or the victim's package-resolution path. 2. A user follows `SETUP.md` and runs `pip install Pillow`, or a script-aware runner resolves the inline `dependencies = ["Pillow"]` declaration. 3. Because no exact version or artifact hash is required, pip accepts the attacker-controlled eligible artifact. 4. Malicious package code can execute during installation or when `scripts/print.py` imports Pillow for image conversion. 5. The payload runs with the privileges of th ...[truncated 781 chars]
- Remediation
- ## Remediation Suggestions 1. Pin Pillow to one reviewed exact version consistently in every dependency declaration, for example: ```toml dependencies = [ "pillow==<reviewed-version>", ] ``` 2. Update the inline script metadata and setup documentation to use the same exact version. 3. Generate and commit a dependency lock file containing hashes for approved distributions. 4. Install with integrity enforcement, such as: ```bash python3 -m pip install --require-hashes -r requirements.txt ``` 5. Restrict installation to the intended package index and use a controlled mirror where practical. 6. Review and update the pinned version through a documented dependency-update process that includes vulnerability scanning, provenance checks, and functional testing. 7. Prefer installation in an isolated virtual environment under a non-privileged account.
