Ottergram (Stored XSS)
A stored cross-site scripting vulnerability in the direct message preview feature allowed an attacker to send a malicious message that executed JavaScript when the recipient previewed it, enabling theft of the admin's localStorage data including a flag and JWT token.
medium.com
Published on medium.com
Ottergram is a social media platform similar to Instagram, featuring user profiles, photo uploads, comments, likes, and a direct messaging system. The messaging feature uses Socket.IO (WebSocket) for real-time notifications and message previews.
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
Impact
An attacker could steal the admin's localStorage data, including a flag and JWT token, leading to full account takeover and access to admin endpoints.
What the attacker needed
A free account; victim previews the message
The fix
The message preview should sanitise user content before inserting it into the DOM, for example by using textContent or a trusted HTML sanitiser.
How it was found
- Register two accounts to test the messaging feature.
- Send a message containing an XSS payload from one account to the other.
- Preview the message to confirm the script executes.
- Set up an external webhook to receive exfiltrated data.
- Send a message with a payload that steals localStorage to the admin account.
- Wait for the admin bot to preview the message and receive the exfiltrated data at the webhook.
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.
This is a stored cross-site scripting (XSS) bug. When someone sends a direct message, the message preview is shown as raw HTML instead of plain text. An attacker can include a script in the message, and when the victim clicks to preview it, the script runs in their browser and can steal data like login tokens.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.