CVE-2022-31160: Jquery ui Cross-Site Scripting Vulnerability

MODERATE
Advisory Identifier: GHSA-h6gj-6jjq-h8g9
CVSS 6.1
CWE-79
Published
Advisory Summary

CVE-2022-31160 is a MODERATE (CVSS 6.1) 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 jquery ui vulnerable to xss when refreshing a checkboxradio with an html-like initial text label. Remediation is available by upgrading affected packages to version 1.13.2, 8.0.0.

CVE-2022-31160 at a Glance

CVE Identifier CVE-2022-31160
GHSA Identifier GHSA-h6gj-6jjq-h8g9
Severity MODERATE
CVSS v3.1 Base Score 6.1
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.1

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:C/C:L/I:L/A:N).

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

How to Fix CVE-2022-31160

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.2
npm install jquery-ui@1.13.2
org.webjars.npm:jquery-ui fixed: 1.13.2
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>jquery-ui</artifactId>
    <version>1.13.2</version>
</dependency>
jquery-ui-rails fixed: 8.0.0
Upgrade jquery-ui-rails to 8.0.0
jQuery.UI.Combined fixed: 1.13.2
Upgrade jQuery.UI.Combined to 1.13.2
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-2022-31160, 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.2), 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 Initializing a checkboxradio widget on an input enclosed within a label makes that parent label contents considered as the input label. If you call `.checkboxradio( "refresh" )` on such a widget and the initial HTML contained encoded HTML entities, they will erroneously get decoded. This can lead to potentially executing JavaScript code. For example, starting with the following initial secure HTML: ```html <label> <input id="test-input"> &lt;img src=x onerror="alert(1)"&gt; </label> ``` and calling: ```js $( "#test-input" ).checkboxradio(); $( "#test-input" ).checkboxradio( "refresh" ); ``` will turn the initial HTML into: ```html <label> <!-- some jQuery UI elements --> <input id="test-input"> <img src=x onerror="alert(1)"> </label> ``` and the alert will get executed. ### Patches The bug has been patched in jQuery UI 1.13.2. ### Workarounds To remediate the issue, if you can change the initial HTML, you can wrap all the non-input contents of the `label` in a `span`: ```html <label> <input id="test-input"> <span>&lt;img src=x onerror="alert(1)"&gt;</span> </label> ``` ### References https://blog.jqueryui.com/2022/07/jquery-ui-1-13-2-released/ ### 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?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc). If you don't find an answer, open a new issue.

CVE-2022-31160 Affected Jquery ui Versions

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

References

GitHub Advisory / Wiki ADVISORY
https://github.com/jquery/jquery-ui/security/advisories/GHSA-h6gj-6jjq-h8g9
NVD — CVE-2022-31160 NVD
https://nvd.nist.gov/vuln/detail/CVE-2022-31160
Security Fix Commit FIX COMMIT
https://github.com/jquery/jquery-ui/commit/8cc5bae1caa1fcf96bf5862c5646c787020ba3f9
Jquery ui Release RELEASE
https://blog.jqueryui.com/2022/07/jquery-ui-1-13-2-released
Jquery ui Source Repository REPOSITORY
https://github.com/jquery-ui-rails/jquery-ui-rails/blob/master/VERSIONS.md
Jquery ui Release RELEASE
https://github.com/jquery-ui-rails/jquery-ui-rails/releases/tag/v8.0.0-release
Jquery ui Source Repository REPOSITORY
https://github.com/jquery/jquery-ui
Jquery ui Source Repository REPOSITORY
https://github.com/rubysec/ruby-advisory-db/blob/master/gems/jquery-ui-rails/CVE-2022-31160.yml
lists.debian.org/debian-lts-announce... WEB
https://lists.debian.org/debian-lts-announce/2022/12/msg00015.html
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/6XBR3G3JR5ZIOJDO4224M3INXDS2VFDD
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/J5LGNTICB5BRFAG3DHVVELS6H3CZSQMO
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/QB2FJQXCNHO32VGVOC6DY6IPGVE4VDU6
Jquery ui Security Information SECURITY
https://security.netapp.com/advisory/ntap-20220909-0007
www.drupal.org/sa-contrib-2022-052 WEB
https://www.drupal.org/sa-contrib-2022-052

Frequently Asked Questions

What is CVE-2022-31160?
CVE-2022-31160 is a security vulnerability in Jquery ui involving jQuery UI vulnerable to XSS when refreshing a checkboxradio with an HTML-like initial text label 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.2, 8.0.0 across affected packages: jquery-ui, org.webjars.npm:jquery-ui, jquery-ui-rails, jQuery.UI.Combined.
What version fixes CVE-2022-31160?
Upgrading to 1.13.2, 8.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.2. Upgrade your dependency to 1.13.2 or later.
Is jquery-ui-rails affected?
Yes, jquery-ui-rails is affected in releases prior to 8.0.0. Upgrade your dependency to 8.0.0 or later.
What is the CVSS score of CVE-2022-31160?
CVE-2022-31160 has a CVSS v3.1 base score of 6.1 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N.
What CWE is associated with CVE-2022-31160?
CVE-2022-31160 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-2022-31160?
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-h6gj-6jjq-h8g9",
  "modified" : "2025-07-21T18:33:47Z",
  "published" : "2022-07-18T17:07:36Z",
  "aliases" : [ "CVE-2022-31160" ],
  "summary" : "jQuery UI vulnerable to XSS when refreshing a checkboxradio with an HTML-like initial text label",
  "details" : "### Impact\nInitializing a checkboxradio widget on an input enclosed within a label makes that parent label contents considered as the input label. If you call `.checkboxradio( \"refresh\" )` on such a widget and the initial HTML contained encoded HTML entities, they will erroneously get decoded. This can lead to potentially executing JavaScript code.\n\nFor example, starting with the following initial secure HTML:\n```html\n<label>\n\t<input id=\"test-input\">\n\t&lt;img src=x onerror=\"alert(1)\"&gt;\n</label>\n```\nand calling:\n```js\n$( \"#test-input\" ).checkboxradio();\n$( \"#test-input\" ).checkboxradio( \"refresh\" );\n```\nwill turn the initial HTML into:\n```html\n<label>\n\t<!-- some jQuery UI elements -->\n\t<input id=\"test-input\">\n\t<img src=x onerror=\"alert(1)\">\n</label>\n```\nand the alert will get executed.\n\n### Patches\nThe bug has been patched in jQuery UI 1.13.2.\n\n### Workarounds\nTo remediate the issue, if you can change the initial HTML, you can wrap all the non-input contents of the `label` in a `span`:\n```html\n<label>\n\t<input id=\"test-input\">\n\t<span>&lt;img src=x onerror=\"alert(1)\"&gt;</span>\n</label>\n```\n\n### References\nhttps://blog.jqueryui.com/2022/07/jquery-ui-1-13-2-released/\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?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc). 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:C/C:L/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "jquery-ui"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.13.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.webjars.npm:jquery-ui"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.13.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "jquery-ui-rails"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "8.0.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "NuGet",
      "name" : "jQuery.UI.Combined"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.13.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/jquery/jquery-ui/security/advisories/GHSA-h6gj-6jjq-h8g9"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-31160"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/jquery/jquery-ui/commit/8cc5bae1caa1fcf96bf5862c5646c787020ba3f9"
  }, {
    "type" : "WEB",
    "url" : "https://blog.jqueryui.com/2022/07/jquery-ui-1-13-2-released"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/jquery-ui-rails/jquery-ui-rails/blob/master/VERSIONS.md"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/jquery-ui-rails/jquery-ui-rails/releases/tag/v8.0.0-release"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/jquery/jquery-ui"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/jquery-ui-rails/CVE-2022-31160.yml"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2022/12/msg00015.html"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/6XBR3G3JR5ZIOJDO4224M3INXDS2VFDD"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/J5LGNTICB5BRFAG3DHVVELS6H3CZSQMO"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/QB2FJQXCNHO32VGVOC6DY6IPGVE4VDU6"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20220909-0007"
  }, {
    "type" : "WEB",
    "url" : "https://www.drupal.org/sa-contrib-2022-052"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-07-18T17:07:36Z",
    "nvd_published_at" : "2022-07-20T20:15:00Z"
  }
}