From “Meh, It’s Just Reflected XSS” to “Sh*t, I Own the C
A reflected XSS vulnerability in an AI chatbot allowed execution of arbitrary JavaScript, and because authentication tokens were stored in localStorage, an attacker could steal a high-privilege user's session token and achieve account takeover.
By Shah kaif | How I went from disappointment to shock in 30 minutes |LinkedIn | Youtube
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 chatbot reflected user-supplied HTML/JavaScript without sanitisation, and the application stored authentication tokens in localStorage, making them accessible to any JavaScript running on the page.
Impact
An attacker could steal a high-privilege user's session token and gain full account takeover, accessing internal systems and data.
What the attacker needed
Victim views the malicious chatbot message; victim has an active session
The fix
The application should store authentication tokens in HTTP-only cookies and sanitise chatbot output to prevent XSS.
How it was found
- Test the AI chatbot with XSS payloads and observe they execute.
- Inspect browser DevTools to find authentication tokens stored in localStorage.
- Craft a payload that reads the token from localStorage and sends it to an external server.
- Send the payload via the chatbot and wait for the token to be exfiltrated.
- Decode the stolen JWT to identify the victim account.
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.
The chatbot echoed back user input without cleaning it, so a malicious script could run in a victim's browser. The site also kept login tokens in a place any script can read, so the script could copy the token and let the attacker log in as that user.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.