CVE-2024-45801: Dompurify DOMPurify Allows Tampering By Prototype Vulnerability
HIGHCVE-2024-45801 is a HIGH (CVSS 7.0) dompurify allows tampering by prototype vulnerability (CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')) affecting Dompurify libraries in the npm ecosystem. The issue involves dompurify allows tampering by prototype pollution. Remediation is available by upgrading affected packages to version 2.5.4, 3.1.3.
CVE-2024-45801 at a Glance
Security Impact
CVSS: 7.0
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:H/A:L).
How to Fix CVE-2024-45801
To remediate this vulnerability, upgrade all affected Dompurify dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install dompurify@2.5.4
npm install dompurify@3.1.3
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls dompurify
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2024-45801, inspect your project dependencies using npm:
npm ls dompurify
Analyze the terminal output to locate any version of Dompurify in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.5.4), your application is affected.
Note: The npm ls dompurify command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution'), where the product receives input from an upstream component that specifies attributes that are to be initialized or updated in an object, but it does not properly control modifications of attributes of the object prototype. In Dompurify, 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-2024-45801 Affected Dompurify Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
dompurify
|
npm |
< 2.5.4
|
2.5.4
|
|
dompurify
|
npm |
≥ 3.0.0
< 3.1.3
|
3.1.3
|
References
Frequently Asked Questions
What is CVE-2024-45801?
Which Dompurify versions are affected?
What version fixes CVE-2024-45801?
Is dompurify affected?
What is the CVSS score of CVE-2024-45801?
What CWE is associated with CVE-2024-45801?
How can I check npm dependencies for CVE-2024-45801?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-mmhx-hmjr-r674",
"modified" : "2024-09-16T22:37:33Z",
"published" : "2024-09-16T20:34:26Z",
"aliases" : [ "CVE-2024-45801" ],
"summary" : "DOMPurify allows tampering by prototype pollution",
"details" : "It has been discovered that malicious HTML using special nesting techniques can bypass the depth checking added to DOMPurify in recent releases. It was also possible to use Prototype Pollution to weaken the depth check.\n\nThis renders dompurify unable to avoid XSS attack.\n\nFixed by https://github.com/cure53/DOMPurify/commit/1e520262bf4c66b5efda49e2316d6d1246ca7b21 (3.x branch) and https://github.com/cure53/DOMPurify/commit/26e1d69ca7f769f5c558619d644d90dd8bf26ebc (2.x branch).",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:H/A:L"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:H/AT:N/PR:N/UI:N/VC:L/VI:H/VA:L/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "dompurify"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.5.4"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "dompurify"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.0.0"
}, {
"fixed" : "3.1.3"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/cure53/DOMPurify/security/advisories/GHSA-mmhx-hmjr-r674"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-45801"
}, {
"type" : "WEB",
"url" : "https://github.com/cure53/DOMPurify/commit/1e520262bf4c66b5efda49e2316d6d1246ca7b21"
}, {
"type" : "WEB",
"url" : "https://github.com/cure53/DOMPurify/commit/26e1d69ca7f769f5c558619d644d90dd8bf26ebc"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/cure53/DOMPurify"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-1321", "CWE-1333" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2024-09-16T20:34:26Z",
"nvd_published_at" : "2024-09-16T19:16:11Z"
}
}