-
-
Notifications
You must be signed in to change notification settings - Fork 200
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
Cross Site Scripting #564
Comments
here |
Because of the use of innerHTML here instead of innerText, it is possible to inject HTML which is interpreted: I used the following HTML page as an example: <html>
<head>
<script src="https://unpkg.com/slim-select@latest/dist/slimselect.min.js"></script>
<link href="https://unpkg.com/slim-select@latest/dist/slimselect.css" rel="stylesheet"></link>
</head>
<body>
<select id="selectElement">
<option><IMG SRC=X ONERROR=alert(2)></IMG></option>
<option><img src=x onerror=alert(1)></img></option>
<option>Option 3</option>
</select>
<script>
new SlimSelect({
select: '#selectElement'
})
</script>
</body>
</html> It is important to note that the payload is HTML encoded. Changing the selected option on the page leads to the execution of JavaScript: |
Sorry i just dont see this as a slim select issue. |
@Skileau You told another company about this? |
Yes, I reported it during a pentest as it's my job and the usual process, and reached out to you so we can secure this issue upstream. |
Your letting someone submit XSS attacks through your input fields, save them into the database, serve them up to another user, inject it into a ui select dropdown and want to say the ui select dropdown is the issue? |
If you have a fix for this that doesn't effect how things currently work. Submit a pr |
Is there a specific reason why you are using innerHTML rather than innerText here ? |
Nope, dont care what value it is as long as it works. If you have a fix for this that doesn't effect how things currently work. Submit a pr |
I am not a developer so I would not be able to provide you with a fix and confirm that it would not break anything, sorry. You can try to replace it with an innerText and build the application on your side to make sure that it works well. <html>
<head>
<script src="https://unpkg.com/slim-select@latest/dist/slimselect.min.js"></script>
<link href="https://unpkg.com/slim-select@latest/dist/slimselect.css" rel="stylesheet"></link>
</head>
<body>
<select id="selectElement">
<option><IMG SRC=X ONERROR=alert(1)></IMG></option>
<option>Option 2</option>
<option>Option 3</option>
</select>
<script>
new SlimSelect({
select: '#selectElement',
})
</script>
</body>
</html> As long as once you change the selection and it does not trigger the alert(1), then the reported vulnerability can be considered as fixed. Also notice that this example is provided as a PoC but I exploited this vulnerability in a global application during a security assessment to elevate my privileges to super admin as I was able to inject a malicious payload into one of the list. Even though it was their choice to let users create new options, I think that this is a frequent use case and it cannot be ignored ... |
"I am not a developer" - ok thanks have a good one |
Dependabot also warned us about a potential risk for slimselect:
|
I can't see any reason why innerText should not be used here instead of innerHTML. |
update the code and add a test. submit a pr and ill get it in. |
Hi @brianvoe UPDATE: the original PR did not pass the test suite. I changed |
patch for #564: Use textContent instead of innerHTML for setting an option's text
v2.9.2 |
Thanks for fixing this @Shoplifter! |
Describe the bug
I have found a Cross Site Scripting in the library, where should I submit the PoC?
The text was updated successfully, but these errors were encountered: