CVE-2023-50262: Dompdf/dompdf Denial of Service Vulnerability
MODERATECVE-2023-50262 is a MODERATE (CVSS 5.3) denial of service vulnerability (CWE-20: Improper Input Validation) affecting Dompdf/dompdf libraries in the Packagist ecosystem. The issue involves denial of service caused by infinite recursion when parsing svg images. Remediation is available by upgrading affected packages to version 2.0.4.
CVE-2023-50262 at a Glance
Security Impact
CVSS: 5.3
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L).
How to Fix CVE-2023-50262
To remediate this vulnerability, upgrade all affected Dompdf/dompdf dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade dompdf/dompdf to 2.0.4
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for dompdf/dompdf
How to Check if You Are Affected
To determine whether your application is affected by CVE-2023-50262, inspect your project dependencies for Dompdf/dompdf:
inspect dependencies for dompdf/dompdf
Analyze the terminal output to locate any version of Dompdf/dompdf in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.0.4), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. In Dompdf/dompdf, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2023-50262 Affected Dompdf/dompdf Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
dompdf/dompdf
|
Packagist |
< 2.0.4
|
2.0.4
|
References
Frequently Asked Questions
What is CVE-2023-50262?
Which Dompdf/dompdf versions are affected?
What version fixes CVE-2023-50262?
Is dompdf/dompdf affected?
What is the CVSS score of CVE-2023-50262?
What CWE is associated with CVE-2023-50262?
How can I check Packagist dependencies for CVE-2023-50262?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-3qx2-6f78-w2j2",
"modified" : "2023-12-13T23:09:04Z",
"published" : "2023-12-13T23:09:04Z",
"aliases" : [ "CVE-2023-50262" ],
"summary" : "Denial of service caused by infinite recursion when parsing SVG images",
"details" : "### Summary\nWhen parsing SVG images Dompdf performs an initial validation to ensure that paths within the SVG are allowed. One of the validations is that the [SVG document does not reference itself](https://github.com/dompdf/dompdf/blob/v2.0.3/src/Image/Cache.php#L136-L153). However, a recursive chained using two or more SVG documents is not correctly validated. Depending on the system configuration and attack pattern this could exhaust the memory available to the executing process and/or to the server itself.\n\n### Details\nphp-svg-lib, when run in isolation, does not support SVG references for `image` elements. An SVG document can, however, be referenced and Dompdf will run that reference through the same validation. Dompdf currently includes validation to prevent self-referential `image` references, but a chained reference is not checked. A malicious actor may thus trigger infinite recursion in the validation process by chaining references between two or more SVG images.\n\n### PoC\n\nThis following sources can be used to bypass validation provided by Dompdf:\n\nrecurse.html\n```\n<img src=\"one.svg\">\n```\n\none.svg\n```\n<svg width=\"200\" height=\"200\" xmlns=\"http://www.w3.org/2000/svg\">\n <image href=\"two.svg\" />\n</svg>\n```\n\ntwo.svg\n```\n<svg width=\"200\" height=\"200\" xmlns=\"http://www.w3.org/2000/svg\">\n <image href=\"one.svg\" />\n</svg>\n```\n\n### Impact\n\nWhen Dompdf parses the above payload, it will crash due after exceeding the allowed execution time or memory usage. An attacker sending multiple request to a system can potentially cause resource exhaustion to the point that the system is unable to handle incoming request.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Packagist",
"name" : "dompdf/dompdf"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.0.4"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/dompdf/dompdf/security/advisories/GHSA-3qx2-6f78-w2j2"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-50262"
}, {
"type" : "WEB",
"url" : "https://github.com/dompdf/dompdf/commit/41cbac16f3cf56affa49f06e8dae66d0eac2b593"
}, {
"type" : "WEB",
"url" : "https://github.com/FriendsOfPHP/security-advisories/blob/master/dompdf/dompdf/CVE-2023-50262.yaml"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/dompdf/dompdf"
}, {
"type" : "WEB",
"url" : "https://github.com/dompdf/dompdf/blob/v2.0.3/src/Image/Cache.php#L136-L153"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-20" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2023-12-13T23:09:04Z",
"nvd_published_at" : "2023-12-13T21:15:09Z"
}
}