CVE-2021-31812 — pdfbox
MEDIUMCVE-2021-31812 is a medium-severity (CVSS 5.5) CWE-834 vulnerability in org.apache.pdfbox:pdfbox. A fix is available for org.apache.pdfbox:pdfbox — see the affected versions and patch details below.
Infinite Loop in Apache PDFBox
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
Where this sits among everything scored
Real-World Exposure
org.apache.pdfbox:pdfbox☕org.apache.pdfbox:pdfbox-parentReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects Maven packages — download data is not available via public APIs for these ecosystems.
Description
In Apache PDFBox, a carefully crafted PDF file can trigger an infinite loop while loading the file. This issue affects Apache PDFBox version 2.0.23 and prior 2.0.x versions.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| ☕Maven | org.apache.pdfbox:pdfbox | ≥ 2.0.0&&< 2.0.24 | 2.0.24org.apache.pdfbox:pdfbox:2.0.24 |
| ☕Maven | org.apache.pdfbox:pdfbox-parent | ≥ 2.0.0&&< 2.0.24 | 2.0.24org.apache.pdfbox:pdfbox-parent:2.0.24 |
Affected Products
pdfboxapachefedorafedoraprojectbanking corporate lending process managementoraclebanking credit facilities process managementoraclebanking supply chain financeoraclecommunications messaging serveroracleDetection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for org.apache.pdfbox:pdfbox, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update org.apache.pdfbox:pdfbox to 2.0.24 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2021-31812 is resolved across your whole dependency graph.
Workarounds
Cap what an attacker can consume: apply request size, rate and timeout limits in front of the affected component, and run it with memory and CPU limits so exhaustion degrades one worker rather than the whole service.
Fixing This On Your OS
If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.
Frequently Asked Questions
Is CVE-2021-31812 in your dependencies?
Find it across Maven, including transitive dependencies.