What’s Vulnerable › Vulnerabilities
CVE-2021-3838: PHAR Deserialization in dompdf/dompdf
- Severity: critical (CVSS 9.8 v3.1)
- Exploited in the wild: not listed in CISA KEV
- EPSS: 1.4% probability of exploitation in the next 30 days
- Public exploit or detection template: yes
- Published: 2024-11-15 · updated 2026-06-17
- Weakness: CWE-502
Description
DomPDF before version 2.0.0 is vulnerable to PHAR deserialization due to a lack of checking on the protocol before passing it into the file_get_contents() function. An attacker who can upload files of any type to the server can pass in the phar:// protocol to unserialize the uploaded file and instantiate arbitrary PHP objects. This can lead to remote code execution, especially when DOMPdf is used with frameworks with documented POP chains like Laravel or vulnerable developer code.
Affected products
- dompdf: before 2.0.0 — fixed in 2.0.0
- Packagist Dompdf/Dompdf: before 2.0.0; v0.6.0, v0.6.1, v0.6.2, v0.7.0, v0.7.0-beta, v0.7.0-beta2 (+16) — fixed in 2.0.0
How to fix
Upgrade to a fixed version: dompdf 2.0.0; Packagist Dompdf/Dompdf 2.0.0. Check the vendor advisory for mitigations.
References
- https://github.com/dompdf/dompdf/commit/99aeec1efec9213e87098d42eb09439e7ee0bb6a
- https://huntr.com/bounties/0bdddc12-ff67-4815-ab9f-6011a974f48e
Get alerted when CVE-2021-3838 or the next vulnerability affects your stack