Summary
Improper handling of user input allows an attacker to execute malicious javascript on anyone viewing his quote submission.
Details
The vulnerability is possible due to this part of the code (quote-approve.ts):
function updateList(): void {
$("#quoteApproveModal .quotes").empty();
quotes.forEach((quote, index) => {
const quoteEl = $(`
<div class="quote" data-id="${index}" data-db-id="${quote._id}">
<textarea class="text">${quote.text}</textarea>
<input type="text" class="source" placeholder="Source" value="${
quote.source
}">
quote.text and quote.source are user input, and they're inserted straight into the DOM. If they contain HTML tags, they will be rendered (after some escaping using quotes and textarea tags).
PoC
- Switch to quotes mode on monkeytype
- Click on the search icon
- Click on "Submit a quote"
- Enter your payload in the "text" input box or in the "source" input box (for example:
</textarea><script>alert('XSS')</script><textarea>).
- Click on "Submit"
- When someone views your quote, the payload will execute
Impact
This impacts whoever views the malicious quote.
Summary
Improper handling of user input allows an attacker to execute malicious javascript on anyone viewing his quote submission.
Details
The vulnerability is possible due to this part of the code (
quote-approve.ts):quote.textandquote.sourceare user input, and they're inserted straight into the DOM. If they contain HTML tags, they will be rendered (after some escaping using quotes and textarea tags).PoC
</textarea><script>alert('XSS')</script><textarea>).Impact
This impacts whoever views the malicious quote.