jQuery Cross Site Scripting in htmlPrefilter

Severity: low · CVSS 3.1 · Published 2023-06-26

jQuery, a widely used JavaScript library for web development, contains a security flaw in how it processes HTML tags. An attacker could use this vulnerability to execute malicious scripts in a user's browser when they visit a compromised or specially crafted website. This could lead to unauthorized actions being performed on behalf of the user or the theft of sensitive session information.

Technologies: org.webjars.npm:jquery (Maven), jquery-rails (RubyGems). Vendors: Maven, RubyGems.

Quick answers

Is This vulnerability exploited in the wild?
No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.
How severe is This vulnerability?
Low severity, with a CVSS score of 3.1, published 26 June 2023.
Which products and versions are affected?
org.webjars.npm:jquery (Maven) ECOSYSTEM:introduced=1.0.3,fixed=3.5.0; jquery-rails (RubyGems) ECOSYSTEM:introduced=0,fixed=4.4.0.
Is there a fix for This vulnerability?
Yes. org.webjars.npm:jquery (Maven): upgrade to 3.5.0 or later; jquery-rails (RubyGems): upgrade to 4.4.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is This vulnerability attacked?
It is attacked over the network, in a software library.
Am I affected?
Check whether you run org.webjars.npm:jquery (Maven) or jquery-rails (RubyGems) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • org.webjars.npm:jquery (Maven): upgrade to 3.5.0 or later
    # set org.webjars.npm:jquery to 3.5.0 in your pom.xml or build.gradle
  • jquery-rails (RubyGems): upgrade to 4.4.0 or later
    bundle update jquery-rails

Technical details

A Cross-Site Scripting (XSS) vulnerability exists in jQuery versions prior to 3.5.0 due to the way the 'jQuery.htmlPrefilter' method uses a regular expression to ensure XHTML-compliant closing tags. This regex-based transformation can be bypassed or manipulated using specific HTML elements, such as <option>, leading to unintended rendering and script execution. A remote attacker can exploit this by passing specially crafted HTML strings to jQuery manipulation methods (like .html() or .append()). The vulnerability is resolved in jQuery 3.5.0 by changing 'htmlPrefilter' to an identity function that no longer performs regex transformations. This issue is also tracked as a duplicate of CVE-2020-11023.

Affected products

  • jquery jquery >= 1.0.3, < 3.5.0
  • rails jquery-rails < 4.4.0
  • NuGet jQuery >= 1.0.3, < 3.5.0

Timeline

  • 2020-03-16: patched: Fix committed to jQuery repository
  • 2020-04-10: advisory: jQuery 3.5.0 released with security fix
  • 2023-06-26: disclosed: Initial publication of this advisory record
  • 2024-05-15: other: Advisory withdrawn as a duplicate of GHSA-jpcq-cgw6-v4j6

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.