MediumGHSA-2pqj-h3vj-pqgwCVE-2012-6708

Cross-Site Scripting in jquery

Published 1 Sept 2020 · Updated 8 Mar 2024

Is your project on an affected jquery?

Private repo? Upload its lockfile instead, or connect GitHub to check every repo.

Affected package

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

Details

Affected versions of jquery are vulnerable to cross-site scripting. This occurs because the main jquery function uses a regular expression to differentiate between HTML and selectors, but does not properly anchor the regular expression. The result is that jquery may interpret HTML as selectors when given certain inputs, allowing for client side code execution.

Proof of Concept

$("#log").html(
    $("element[attribute='<img src=\"x\" onerror=\"alert(1)\" />']").html()
);

Recommendation

Update to version 1.9.0 or later.

Is GHSA-2pqj-h3vj-pqgw 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.

More advisories for jquery

  • MediumCVE-2011-4969jQuery vulnerable to Cross-Site Scripting (XSS) · 14 May 2022
  • MediumCVE-2020-7656Cross-Site Scripting in jquery · 20 May 2020
  • MediumCVE-2020-11023Potential XSS vulnerability in jQuery · 29 Apr 2020
  • MediumCVE-2020-11022Potential XSS vulnerability in jQuery · 29 Apr 2020
  • MediumCVE-2019-11358XSS in jQuery as used in Drupal, Backdrop CMS, and other products · 26 Apr 2019
  • HighCVE-2016-10707Denial of Service in jquery · 22 Jan 2018
All 8 advisories for jquery

References

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