T08 · Insecure Dependencies
- Location
requirements.txt:1- Finding
Unbounded Third-Party Dependency Creates Supply-Chain Exposure
- Content
View full analysis
Vulnerability Details
File Locations:
requirements.txt:1setup.py:22-24README.md:25-29
Vulnerability Type: Unpinned and unverified third-party dependency
Risk Level: MediumVulnerable Code
requirements.txt:1text pdfrw>=0.4setup.py:22-24python install_requires=[ "pdfrw>=0.4", ],README.md:25-29markdown 2. Install pdfrw: ```bash pip install pdfrw ```Technical Analysis
The project installs
pdfrwwithout an exact version, upper version boundary, package hash, or lock file. The constraint allows the package resolver to install any release from version 0.4 onward, including future releases that were not reviewed by the project maintainers.The documentation also instructs users to install the latest package resolved under the name
pdfrw, without identifying a trusted package index or providing integrity verification. Consequently, dependency resolution is mutable and builds are not reproducible.This does not demonstrate that the current
pdfrwrelease is malicious. The vulnerability is the project's implicit trust in any future matching artifact. A compromised maintainer account, package-index compromise, or malicious future release could introduce attacker-controlled installation or runtime code.Attack Path
- An attacker compromises the upstream package, its publishing account, or the package distribution channel.
- The attacker publishes a malicious
pdfrwrelease whose version satisfiespdfrw>=0.4. - A user installs this project, runs
pip install -r requirements.txt, or follows the documentedpip install pdfrwinstruction. - The package resolver selects and downloads the malicious release because no exact version or integrity hash is enforced.
- Attacker-controlled dependency code executes during installation, import, or PDF processing with the privileges of the installing or ...[truncated 672 chars]
- Remediation
View remediation
Remediation Suggestions
- Replace the open-ended dependency constraint with an exact, reviewed version:
text pdfrw==0.4 - Generate a hash-locked requirements file using a dependency-management tool such as
pip-tools, Poetry, or an equivalent mechanism:text pdfrw==0.4 \ --hash=sha256:<verified-package-hash> - Install production dependencies with hash verification:
bash pip install --require-hashes -r requirements.txt - Retain the exact runtime version in the lock file even if
setup.pyuses a compatibility range for library consumers. - Configure builds to use an explicitly trusted package index and prevent fallback to untrusted indexes.
- Review release provenance, package signatures where available, maintainer changes, and dependency diffs before updating the pinned version.
- Run dependency installation and PDF processing inside a least-privileged virtual environment or isolated container.
- Add automated dependency scanning and a controlled update process so security fixes can be adopted without silently accepting arbitrary future releases.
- Replace the open-ended dependency constraint with an exact, reviewed version:
