Dastardly XSS attacks, and Socratic Seminars
A chatroom rendered user messages as HTML, so a message containing a script tag executed in every participant's browser. The author's script reloaded the page on each render, creating an endless reload loop that locked the class out of the chat.
medium.com
Published on medium.com
Years ago, as a high schooler, I discovered and accidentally performed a malicious XSS attack, making my classmates Socratic seminar submissions for the past hour inaccessible. That happened unintentionally, and making it right was an order of magnitude more complex than performing it.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the chat inserted message content into the page as HTML rather than as plain text, so any markup or script in a message was executed by every viewer's browser.
Impact
Every participant's page reloaded in an endless loop, making the chat unusable and the session's submissions inaccessible.
What the attacker needed
A chatroom that renders messages as HTML; victim views the message
The fix
The author worked around it by overriding a script to replace innerHTML with textContent, but the underlying fix should be to render messages as text rather than HTML.
How it was found
- Discover that messages accept HTML by embedding an image tag
- Send a message containing a script tag and see an alert box appear for other users
- Send a message whose script reloads the page
- Observe every participant's screen reload repeatedly with no way to stop it
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Cross-site scripting (XSS) happens when a website shows what a user typed as if it were part of the page's own code. Here the chat displayed messages as HTML, so a message containing a script tag ran as code in everyone else's browser. Because the script told the page to reload, and the message was shown again after each reload, the page kept refreshing forever.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.