Open this page and hover the "XSS bug"-button:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>XSS bug</title>
<script src="../_test.js"></script>
<script src="../../src/js/components/tooltip.js"></script>
</head>
<body>
<button class="uk-button" data-uk-tooltip title="<img src=aa onerror=alert(1);>">XSS bug</button>
</body>
</html>
The problem is line 84 in uikit/src/js/components/tooltip.js. this.tip should be html-encoded:
$tooltip.html('<div class="uk-tooltip-inner">' + this.tip + '</div>');
or:
$tooltip.html( $('<div class="uk-tooltip-inner">').text(this.tip) );
hi,
I see you point, but I think this should be the responsibility of the one who creates the site. He should escape the string if it is needed.
Greets,
Artur
But this means I have to double-quote the title-text.
E.g., this is vulnerable:
<img title="<script>alert("123")<script>">
This works:
<img title="&lt;script&gt;alert(&quot;123&quot;)&lt;script&gt;">
Most helpful comment
But this means I have to double-quote the title-text.
E.g., this is vulnerable:
<img title="<script>alert("123")<script>">This works:
<img title="&lt;script&gt;alert(&quot;123&quot;)&lt;script&gt;">