Potential XSS vulnerability in jQuery
Published 29 Apr 2020 · Updated 10 Sept 2026
Affected packages
- Affected
- >=1.12.0 <3.5.0
- Fixed in
- 3.5.0
npm install jquery@3.5.0- Affected
- <1.19.0
- Fixed in
- 1.19.0
composer require maximebf/debugbar:^1.19.0- Affected
- <4.0.1
- Fixed in
- 4.0.1
composer require athlon1600/youtube-downloader:^4.0.1- Affected
- >=1.12.0 <3.5.0
- Fixed in
- 3.5.0
composer require components/jquery:^3.5.0Details
Impact
Passing HTML from untrusted sources - even after sanitizing it - to one of jQuery's DOM manipulation methods (i.e. .html(), .append(), and others) may execute untrusted code.
Patches
This problem is patched in jQuery 3.5.0.
Workarounds
To workaround the issue without upgrading, adding the following to your code:
jQuery.htmlPrefilter = function( html ) {
return html;
};You need to use at least jQuery 1.12/2.2 or newer to be able to apply this workaround.
References
https://blog.jquery.com/2020/04/10/jquery-3-5-0-released/ https://jquery.com/upgrade-guide/3.5/
For more information
If you have any questions or comments about this advisory, search for a relevant issue in the jQuery repo. If you don't find an answer, open a new issue.
Is GHSA-gxr4-xjj5-5px2 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 jquery, and gives you the command that fixes it.
References
- Linkgithub.com/jquery/jquery/security/advisories/GHSA-gxr4-xjj5-5px2
- Advisorynvd.nist.gov/vuln/detail/CVE-2020-11022
- Linkgithub.com/maximebf/php-debugbar/issues/447
- Linkgithub.com/jquery/jquery/commit/1d61fd9407e6fbe82fe55cb0b938307aa0791f77
- Linkgithub.com/maximebf/php-debugbar/commit/847216e60544258c881f2733d699bbcfeefac0fc
- Linkblog.jquery.com/2020/04/10/jquery-3-5-0-released
- Linklists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/VOE7P7APPRQKD4FGNHBKJPDY6FFCOH3W
- Linklists.opensuse.org/opensuse-security-announce/2020-07/msg00067.html
- Linklists.opensuse.org/opensuse-security-announce/2020-07/msg00085.html
- Linklists.opensuse.org/opensuse-security-announce/2020-11/msg00039.html
- Linkpacketstormsecurity.com/files/162159/jQuery-1.2-Cross-Site-Scripting.html
- Linksecurity.gentoo.org/glsa/202007-03
- Linkwww.debian.org/security/2020/dsa-4693
- Linkwww.drupal.org/sa-core-2020-002
- Linkwww.oracle.com//security-alerts/cpujul2021.html
- Linkwww.oracle.com/security-alerts/cpuApr2021.html
- Linkwww.oracle.com/security-alerts/cpuapr2022.html
- Linkwww.oracle.com/security-alerts/cpujan2021.html
- Linkwww.oracle.com/security-alerts/cpujan2022.html
- Linkwww.oracle.com/security-alerts/cpujul2020.html
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.