-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Checkboxradio's label text being evaluated as HTML on refresh #2101
Comments
If you generate a Checkboxradio from a checkbox/radio with a label that contains encoded HTML, e.g. `<em>test</em>` this will work fine at first. If, however a refresh is triggered on that instance (explicitly or e.g. by turning it into a `Controlgroup`), the previously escaped HTML will now be evaluated. If the label was created based on some user input, this could lead to unexpected code execution even though the initial output was escaped. Fixes jquerygh-2101
If you generate a Checkboxradio from a checkbox/radio with a label that contains encoded HTML, e.g. `<em>test</em>` this will work fine at first. If, however a refresh is triggered on that instance (explicitly or e.g. by turning it into a `Controlgroup`), the previously escaped HTML will now be evaluated. If the label was created based on some user input, this could lead to unexpected code execution even though the initial output was escaped. Fixes gh-2101 Closes gh-2102
Thanks for the report! PR: #2102. We've just released it as part of 1.13.2: https://blog.jqueryui.com/2022/07/jquery-ui-1-13-2-released/ I'll request a CVE shortly. In the future, please direct security reports at [email protected] instead of GitHub issues so that they are not immediately visible to the whole world. I'll add the |
@Elkano I submitted a security advisory at: |
The issue now has its CVE identifier: |
If you generate a Checkboxradio from a checkbox/radio with a label that contains encoded HTML, e.g.
<em>test</em>
this will work fine at first.If however a refresh is triggered on that instance (explicitly or e.g. by turning it into a
Controlgroup
), the previously escaped HTML will now be evaluated.If the label was created based on some user input, this could lead to unexpected code execution even though the initial output was escaped.
Example:
https://jsfiddle.net/69krwj75/
This is caused by the initial label being read as text (and thus decoded) for text nodes.
jquery-ui/ui/widgets/checkboxradio.js
Line 78 in d66fdd5
When the label is later updated, it is however done via
append
.jquery-ui/ui/widgets/checkboxradio.js
Line 263 in d66fdd5
A fix would likely be to read the initial label text as HTML as well to preserve the encoding of the entities, however the likely was some reason to do things the way they currently are.
Judging from the blame, this bug has existed since the initial code from 8 years ago.
I'm aware that the teams resources are limited but I wanted to at least report the bug.
As a workaround, one can wrap their text into a
<span>
and thus causing it to be read viathis.outerHTML
instead.The text was updated successfully, but these errors were encountered: