|
| 1 | +--- |
| 2 | +gem: jquery-ui-rails |
| 3 | +cve: 2022-31160 |
| 4 | +ghsa: h6gj-6jjq-h8g9 |
| 5 | +url: https://github.com/jquery/jquery-ui/security/advisories/GHSA-h6gj-6jjq-h8g9 |
| 6 | +title: |
| 7 | + jQuery UI vulnerable to XSS when refreshing a checkboxradio with an HTML-like |
| 8 | + initial text label |
| 9 | +date: 2022-07-15 |
| 10 | +description: | |
| 11 | + ### Impact |
| 12 | + Initializing a checkboxradio widget on an input enclosed within a label makes |
| 13 | + that parent label contents considered as the input label. If you call |
| 14 | + `.checkboxradio( "refresh" )` on such a widget and the initial HTML contained |
| 15 | + encoded HTML entities, they will erroneously get decoded. This can lead to |
| 16 | + potentially executing JavaScript code. |
| 17 | +
|
| 18 | + For example, starting with the following initial secure HTML: |
| 19 | +
|
| 20 | + ```html |
| 21 | + <label> |
| 22 | + <input id="test-input"> |
| 23 | + <img src=x onerror="alert(1)"> |
| 24 | + </label> |
| 25 | + ``` |
| 26 | +
|
| 27 | + and calling: |
| 28 | +
|
| 29 | + ```javascript |
| 30 | + $( "#test-input" ).checkboxradio(); |
| 31 | + $( "#test-input" ).checkboxradio( "refresh" ); |
| 32 | + ``` |
| 33 | +
|
| 34 | + will turn the initial HTML into: |
| 35 | +
|
| 36 | + ```html |
| 37 | + <label> |
| 38 | + <!-- some jQuery UI elements --> |
| 39 | + <input id="test-input"> |
| 40 | + <img src=x onerror="alert(1)"> |
| 41 | + </label> |
| 42 | + ``` |
| 43 | +
|
| 44 | + and the alert will get executed. |
| 45 | +
|
| 46 | + ### Patches |
| 47 | + The bug has been patched in jQuery UI 1.13.2. |
| 48 | +
|
| 49 | + ### Workarounds |
| 50 | + To remediate the issue, if you can change the initial HTML, you can wrap all |
| 51 | + the non-input contents of the `label` in a `span`: |
| 52 | +
|
| 53 | + ```html |
| 54 | + <label> |
| 55 | + <input id="test-input"> |
| 56 | + <span><img src=x onerror="alert(1)"></span> |
| 57 | + </label> |
| 58 | + ``` |
| 59 | +
|
| 60 | + ### References |
| 61 | + https://blog.jqueryui.com/2022/07/jquery-ui-1-13-2-released/ |
| 62 | +
|
| 63 | + ### For more information |
| 64 | + If you have any questions or comments about this advisory, search for a |
| 65 | + relevant issue in [the jQuery UI repo](https://github.com/jquery/jquery-ui/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc). |
| 66 | + If you don't find an answer, open a new issue. |
| 67 | +cvss_v3: 6.1 |
| 68 | +patched_versions: |
| 69 | + - ">= 7.0.0" |
| 70 | +related: |
| 71 | + url: |
| 72 | + - https://github.com/jquery/jquery-ui/security/advisories/GHSA-h6gj-6jjq-h8g9 |
| 73 | + - https://nvd.nist.gov/vuln/detail/CVE-2022-31160 |
| 74 | + - https://github.com/advisories/GHSA-h6gj-6jjq-h8g9#:~:text=https%3A//nvd.nist,12/msg00015.html |
| 75 | + - https://blog.jqueryui.com/2022/07/jquery-ui-1-13-2-released/ |
| 76 | + - https://www.drupal.org/sa-contrib-2022-052 |
| 77 | + - https://security.netapp.com/advisory/ntap-20220909-0007/ |
| 78 | + - https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/6XBR3G3JR5ZIOJDO4224M3INXDS2VFDD/ |
| 79 | + - https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/J5LGNTICB5BRFAG3DHVVELS6H3CZSQMO/ |
| 80 | + - https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/QB2FJQXCNHO32VGVOC6DY6IPGVE4VDU6/ |
| 81 | + - https://lists.debian.org/debian-lts-announce/2022/12/msg00015.html |
0 commit comments