CVE-2021-41182: Jquery ui Cross-Site Scripting Vulnerability

MODERATE
Advisory Identifier: GHSA-9gj3-hwp5-pmwc
CVSS 6.5
CWE-79
Published
Advisory Summary

CVE-2021-41182 is a MODERATE (CVSS 6.5) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Jquery ui libraries in the npm ecosystem. The issue involves xss in the `altfield` option of the datepicker widget in jquery-ui. Remediation is available by upgrading affected packages to version 1.13.0, 7.0.0.

CVE-2021-41182 at a Glance

CVE Identifier CVE-2021-41182
GHSA Identifier GHSA-9gj3-hwp5-pmwc
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Jquery ui
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 6.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2021-41182

To remediate this vulnerability, upgrade all affected Jquery ui dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

jquery-ui fixed: 1.13.0
npm install jquery-ui@1.13.0
jQuery.UI.Combined fixed: 1.13.0
Upgrade jQuery.UI.Combined to 1.13.0
jquery-ui-rails fixed: 7.0.0
Upgrade jquery-ui-rails to 7.0.0
org.webjars.npm:jquery-ui fixed: 1.13.0
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>jquery-ui</artifactId>
    <version>1.13.0</version>
</dependency>
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls jquery-ui

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2021-41182, inspect your project dependencies using npm:

npm ls jquery-ui

Analyze the terminal output to locate any version of Jquery ui in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.13.0), your application is affected.

Note: The npm ls jquery-ui command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In Jquery ui, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact Accepting the value of the `altField` option of the Datepicker widget from untrusted sources may execute untrusted code. For example, initializing the datepicker in the following way: ```js $( "#datepicker" ).datepicker( { altField: "<img onerror='doEvilThing()' src='/404' />", } ); ``` will call the `doEvilThing` function. ### Patches The issue is fixed in jQuery UI 1.13.0. Any string value passed to the `altField` option is now treated as a CSS selector. ### Workarounds A workaround is to not accept the value of the `altField` option from untrusted sources. ### For more information If you have any questions or comments about this advisory, search for a relevant issue in [the jQuery UI repo](https://github.com/jquery/jquery-ui/issues). If you don't find an answer, open a new issue.

CVE-2021-41182 Affected Jquery ui Versions

4 component(s)
Fixed Versions:
1.13.07.0.0
Product / Package Ecosystem Affected Versions Fixed Version
jquery-ui
npm
< 1.13.0
1.13.0
jQuery.UI.Combined
NuGet
< 1.13.0
1.13.0
jquery-ui-rails
RubyGems
< 7.0.0
7.0.0
org.webjars.npm:jquery-ui
Maven
< 1.13.0
1.13.0

References

GitHub Advisory / Wiki ADVISORY
https://github.com/jquery/jquery-ui/security/advisories/GHSA-9gj3-hwp5-pmwc
NVD — CVE-2021-41182 NVD
https://nvd.nist.gov/vuln/detail/CVE-2021-41182
Jquery ui Source Repository REPOSITORY
https://github.com/jquery/jquery-ui/pull/1954/commits/6809ce843e5ac4128108ea4c15cbc100653c2b63
Jquery ui Security Information SECURITY
https://www.tenable.com/security/tns-2022-09
Jquery ui Security Information SECURITY
https://www.oracle.com/security-alerts/cpujul2022.html
Jquery ui Security Information SECURITY
https://www.oracle.com/security-alerts/cpuapr2022.html
www.drupal.org/sa-core-2022-002 WEB
https://www.drupal.org/sa-core-2022-002
www.drupal.org/sa-contrib-2022-004 WEB
https://www.drupal.org/sa-contrib-2022-004
Jquery ui Security Information SECURITY
https://security.netapp.com/advisory/ntap-20211118-0004
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/SNXA7XRKGINWSUIPIZ6ZBCTV6N3KSHES
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/SGSY236PYSFYIEBRGDERLA7OSY6D7XL4
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/O74SXYY7RGXREQDQUDQD4BPJ4QQTD2XQ
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/NXIUUBRVLA4E7G7MMIKCEN75YN7UFERW
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/HVKIOWSXL2RF2ULNAP7PHESYCFSZIJE3
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/SNXA7XRKGINWSUIPIZ6ZBCTV6N3KSHES
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/SGSY236PYSFYIEBRGDERLA7OSY6D7XL4
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/O74SXYY7RGXREQDQUDQD4BPJ4QQTD2XQ
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/NXIUUBRVLA4E7G7MMIKCEN75YN7UFERW
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/HVKIOWSXL2RF2ULNAP7PHESYCFSZIJE3
lists.debian.org/debian-lts-announce... WEB
https://lists.debian.org/debian-lts-announce/2023/08/msg00040.html
lists.debian.org/debian-lts-announce... WEB
https://lists.debian.org/debian-lts-announce/2022/01/msg00014.html
Jquery ui Source Repository REPOSITORY
https://github.com/rubysec/ruby-advisory-db/blob/master/gems/jquery-ui-rails/CVE-2021-41182.yml
Jquery ui Source Repository REPOSITORY
https://github.com/jquery/jquery-ui
Jquery ui Release RELEASE
https://blog.jqueryui.com/2021/10/jquery-ui-1-13-0-released

Frequently Asked Questions

What is CVE-2021-41182?
CVE-2021-41182 is a security vulnerability in Jquery ui involving XSS in the `altField` option of the Datepicker widget in jquery-ui under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Jquery ui versions are affected?
Affected versions include releases prior to 1.13.0, 7.0.0 across affected packages: jquery-ui, jQuery.UI.Combined, jquery-ui-rails, org.webjars.npm:jquery-ui.
What version fixes CVE-2021-41182?
Upgrading to 1.13.0, 7.0.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is jquery-ui affected?
Yes, jquery-ui is affected in releases prior to 1.13.0. Upgrade your dependency to 1.13.0 or later.
Is jQuery.UI.Combined affected?
Yes, jQuery.UI.Combined is affected in releases prior to 1.13.0. Upgrade your dependency to 1.13.0 or later.
What is the CVSS score of CVE-2021-41182?
CVE-2021-41182 has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N.
What CWE is associated with CVE-2021-41182?
CVE-2021-41182 is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.).
How can I check npm dependencies for CVE-2021-41182?
Run the dependency tree command: 'npm ls jquery-ui'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-9gj3-hwp5-pmwc",
  "modified" : "2021-10-27T17:00:10Z",
  "published" : "2021-10-26T14:55:02Z",
  "aliases" : [ "CVE-2021-41182" ],
  "summary" : "XSS in the `altField` option of the Datepicker widget in jquery-ui",
  "details" : "### Impact\nAccepting the value of the `altField` option of the Datepicker widget from untrusted sources may execute untrusted code. For example, initializing the datepicker in the following way:\n```js\n$( \"#datepicker\" ).datepicker( {\n\taltField: \"<img onerror='doEvilThing()' src='/404' />\",\n} );\n```\nwill call the `doEvilThing` function.\n\n### Patches\nThe issue is fixed in jQuery UI 1.13.0. Any string value passed to the `altField` option is now treated as a CSS selector.\n\n### Workarounds\nA workaround is to not accept the value of the `altField` option from untrusted sources.\n\n### For more information\nIf you have any questions or comments about this advisory, search for a relevant issue in [the jQuery UI repo](https://github.com/jquery/jquery-ui/issues). If you don't find an answer, open a new issue.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "jquery-ui"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.13.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "NuGet",
      "name" : "jQuery.UI.Combined"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.13.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "jquery-ui-rails"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "7.0.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.webjars.npm:jquery-ui"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.13.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/jquery/jquery-ui/security/advisories/GHSA-9gj3-hwp5-pmwc"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-41182"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/jquery/jquery-ui/pull/1954/commits/6809ce843e5ac4128108ea4c15cbc100653c2b63"
  }, {
    "type" : "WEB",
    "url" : "https://www.tenable.com/security/tns-2022-09"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com/security-alerts/cpujul2022.html"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com/security-alerts/cpuapr2022.html"
  }, {
    "type" : "WEB",
    "url" : "https://www.drupal.org/sa-core-2022-002"
  }, {
    "type" : "WEB",
    "url" : "https://www.drupal.org/sa-contrib-2022-004"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20211118-0004"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/SNXA7XRKGINWSUIPIZ6ZBCTV6N3KSHES"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/SGSY236PYSFYIEBRGDERLA7OSY6D7XL4"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/O74SXYY7RGXREQDQUDQD4BPJ4QQTD2XQ"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/NXIUUBRVLA4E7G7MMIKCEN75YN7UFERW"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/HVKIOWSXL2RF2ULNAP7PHESYCFSZIJE3"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/SNXA7XRKGINWSUIPIZ6ZBCTV6N3KSHES"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/SGSY236PYSFYIEBRGDERLA7OSY6D7XL4"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/O74SXYY7RGXREQDQUDQD4BPJ4QQTD2XQ"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/NXIUUBRVLA4E7G7MMIKCEN75YN7UFERW"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/HVKIOWSXL2RF2ULNAP7PHESYCFSZIJE3"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2023/08/msg00040.html"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2022/01/msg00014.html"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/jquery-ui-rails/CVE-2021-41182.yml"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/jquery/jquery-ui"
  }, {
    "type" : "WEB",
    "url" : "https://blog.jqueryui.com/2021/10/jquery-ui-1-13-0-released"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-10-25T22:06:41Z",
    "nvd_published_at" : "2021-10-26T15:15:00Z"
  }
}