Junglewise Threat Intelligence

jQuery Cross Site Scripting in htmlPrefilter

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

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

Executive brief

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.

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

Related threats