Skip to content
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

XSS vulnerability in option title #1691

Closed
AndreasPresthammer opened this issue Mar 31, 2017 · 3 comments
Closed

XSS vulnerability in option title #1691

AndreasPresthammer opened this issue Mar 31, 2017 · 3 comments
Milestone

Comments

@AndreasPresthammer
Copy link

AndreasPresthammer commented Mar 31, 2017

Reproduced in versions:
bootstrap-select 1.12.2 and latest master
bootstrap 3.3.7
jquery 3.2.1
Tested in Chrome 57

The title attribute is vulnerable to XSS attack.

An option looking like this will trigger javascript evaluation when clicked:
<option title="&lt;script&gt;alert(&#039;xss&#039;);&lt;/script&gt;">My XSS</option>

NB: You must CLICK the option to reproduce the issue.

Issue reproduced in this js fiddle: https://jsfiddle.net/mrbajggc/

Also reproduced against latest master in https://jsfiddle.net/b2q65nbe/2/ as of commit 1574419

@caseyjhol caseyjhol self-assigned this Jul 12, 2017
@caseyjhol caseyjhol added this to the v1.13.0 milestone Jul 13, 2017
@AntGarSil
Copy link

This is still open, observed something similar during a security assessment.

I believe the issue is in the following line

826: this.$button.attr('title', htmlUnescape($.trim(title.replace(/<[^>]*>?/g, ''))));
827: this.$button.children('.filter-option').html(title);

Line 827 is not escaping the title before adding it as child to the element. This could be fixed if escaping as in line 826

827: this.$button.children('.filter-option').html(htmlUnescape($.trim(title.replace(/<[^>]*>?/g, ''))));

@caseyjhol
Copy link
Member

This has been fixed and released in v1.13.0!

@latuszek
Copy link

latuszek commented Feb 13, 2019

@caseyjhol Are You sure this is fixed correctly? The escaped tags are still parsed as non-escaped. <script> tag does not work, but all the others seems to work. Please see:
https://jsfiddle.net/b1dhf8ec/2/

Edit: I've created separate issue for this: #2199

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants