CVE-2022-31160: Jquery ui Cross-Site Scripting Vulnerability
MODERATECVE-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
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).
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.
npm install jquery-ui@1.13.2
<dependency>
<groupId>org.webjars.npm</groupId>
<artifactId>jquery-ui</artifactId>
<version>1.13.2</version>
</dependency>
Upgrade jquery-ui-rails to 8.0.0
Upgrade jQuery.UI.Combined to 1.13.2
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
CVE-2022-31160 Affected Jquery ui Versions
4 component(s)| 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
Frequently Asked Questions
What is CVE-2022-31160?
Which Jquery ui versions are affected?
What version fixes CVE-2022-31160?
Is jquery-ui affected?
Is jquery-ui-rails affected?
What is the CVSS score of CVE-2022-31160?
What CWE is associated with CVE-2022-31160?
How can I check npm dependencies for CVE-2022-31160?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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<img src=x onerror=\"alert(1)\">\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><img src=x onerror=\"alert(1)\"></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"
}
}