DOMPurify allows tampering by prototype pollution
Published 16 Sept 2024 · Updated 10 Sept 2026
Affected packages
- Affected
- <2.5.4
- Fixed in
- 2.5.4
npm install dompurify@2.5.4- Affected
- >=3.0.0 <3.1.3
- Fixed in
- 3.1.3
npm install dompurify@3.1.3Details
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.
This renders dompurify unable to avoid XSS attack.
Fixed by https://github.com/cure53/DOMPurify/commit/1e520262bf4c66b5efda49e2316d6d1246ca7b21 (3.x branch) and https://github.com/cure53/DOMPurify/commit/26e1d69ca7f769f5c558619d644d90dd8bf26ebc (2.x branch).
Is GHSA-mmhx-hmjr-r674 in any of your client repos?
Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected dompurify, and gives you the command that fixes it.
References
- Linkgithub.com/cure53/DOMPurify/security/advisories/GHSA-mmhx-hmjr-r674
- Advisorynvd.nist.gov/vuln/detail/CVE-2024-45801
- Linkgithub.com/cure53/DOMPurify/commit/1e520262bf4c66b5efda49e2316d6d1246ca7b21
- Linkgithub.com/cure53/DOMPurify/commit/26e1d69ca7f769f5c558619d644d90dd8bf26ebc
- Packagegithub.com/cure53/DOMPurify
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.