CVE-2021-3902 is a critical (CVSS 9.8) XML external entity flaw in the SVG parser of Dompdf, the PHP PDF library. It allows server side request forgery and PHAR deserialization in all versions before 2.0.0, even when isRemoteEnabled is false. Upgrade to Dompdf 2.0.0 or later.
What's affected
- Dompdf (dompdf/dompdf), all versions before 2.0.0, per the NVD record.
- Fixed in 2.0.0, which is the version both this and the related CVE-2021-3838 point to.
- The record states the issue can be exploited even when the isRemoteEnabled option is false, so disabling remote access is not a mitigation.
- Applications that render user supplied SVG images into PDFs are the obvious exposure. Be careful about assuming you are safe because you do not accept SVG directly, since SVG can arrive inside HTML.
- KEV status: false in the record.
How to check if you're exposed
Find where Dompdf is installed and at what version.
composer show dompdf/dompdf
composer why dompdf/dompdf
Then check whether any feature of your application passes user content, including HTML with embedded or linked SVG, into Dompdf. Those paths decide whether the parser is reachable.
What to do now
- Raise the Dompdf constraint to
^2.0and runcomposer update dompdf/dompdf. - Regression test any PDF that includes SVG graphics, since the parser handling changed.
- Sanitize or reject user supplied SVG and HTML before it reaches the PDF step.
- Review outbound network rules for the application host. Server side request forgery is much less useful when internal services are not reachable from the web tier.
- Patch CVE-2021-3838 in the same change, since both are fixed by the same upgrade.
Why it matters
The class is CWE-611, improper restriction of XML external entity references. An XML parser that resolves external entities can be told to fetch a local file or a URL as part of reading a document. Here the record says that behavior leads to server side request forgery, disclosure of internal image files, and PHAR deserialization attacks.
The notable detail is that the setting meant to block remote resources did not block this path. That is a reminder that a safe looking option is not a control until you have confirmed it covers every parser in the library. The upgrade is the reliable fix.
Try it yourself
Click through it at your own pace, or open it full screen.
Quick check
Does setting isRemoteEnabled to false protect me?
No. The record says the issue can be exploited even with that option set to false.
Is this the same bug as CVE-2021-3838?
No. Both are fixed in Dompdf 2.0.0, but this one is an XXE flaw in the SVG parser, while the other is PHAR deserialization through missing protocol checks.
Sources
- Upstream Dompdf commit referenced by the NVD record (not retrieved)
- Huntr report listed in the record (not retrieved)
Last reviewed: 19 October 2026.