MediumGHSA-chqj-j4fh-rw7mCVE-2019-16728

Cross-Site Scripting in dompurify

Published 28 Aug 2020 · Updated 8 Nov 2023

Affected package

Affected
<2.0.3
Fixed in
2.0.3
Update to the fixed version for your release line, for example:npm install dompurify@2.0.3

Details

Versions of dompurify prior to 2.0.3 are vulnerable to Cross-Site Scripting (XSS). The package has an XSS filter bypass due to Mutation XSS in both Chrome and Safari through a combination of <svg>/<math> elements and </p>/</br>. An example payload is: <svg></p><style><a id="</style><img src=1 onerror=alert(1)>">. This allows attackers to bypass the XSS protection and execute arbitrary JavaScript in a victim's browser.

Recommendation

Upgrade to version 2.0.3 or later. You may also disallow <svg> and <math> through dompurify configurations:

FORBID_TAGS: ['svg', 'math'] });```

Is GHSA-chqj-j4fh-rw7m 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

Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.