MODERATE 6.1

CVE-2022-31160

jQuery UI vulnerable to XSS when refreshing a checkboxradio with an HTML-like initial text label

Description

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:

<label>
<input id="test-input">
&lt;img src=x onerror="alert(1)"&gt;
</label>

and calling:

$( "#test-input" ).checkboxradio();
$( "#test-input" ).checkboxradio( "refresh" );

will turn the initial HTML into:

<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:

<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. If you don't find an answer, open a new issue.

Affected Maven artifacts (3)

ArtifactAffected versionsFixed in
org.webjars.npm » jquery-ui
< 1.13.2
1.13.2
org.mvnpm » jquery-uivia npm jquery-ui
< 1.13.2
1.13.2
org.webjars » jquery-uivia npm jquery-ui
< 1.13.2
1.13.2
org.webjars.npm » jquery-uivia npm jquery-ui
< 1.13.2
1.13.2

Blast radius

2affected artifacts
29affected versions
716dependent artifacts (est.)
24,985dependent versions

71% of the dependent artifacts (513) still pull an affected version in their latest release.

DepthDependent versions
Direct
2,069
2 hops
11,531
3 hops
8,159
4 hops
2,860
5 hops
347
6 hops
19

Most used dependents

Computed from the dependency graph of build 20261124.0621 (compile and runtime scopes, nearest version wins). Exclusions and dependency management in consuming projects are not applied, so dependents are potentially affected. When several artifacts are affected, a dependent version that pulls more than one of them is counted once per artifact.

Other ecosystems

Also affects npm (1 package) NuGet (1 package) RubyGems (1 package) . See all on OSV