Stealing private messages using XSS on subdomain
A forgotten subdomain was vulnerable to reflected cross-site scripting, and the site's CSRF token cookie was shared across all subdomains without the HttpOnly flag. An attacker could use the XSS to read that token and open a WebSocket connection to the main application, receiving the victim's private chat messages.
{{media:0}}
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 a reflected XSS on a legacy subdomain combined with a CSRF token cookie scoped to all subdomains and lacking the HttpOnly flag, so script on any subdomain could read it.
Impact
An attacker could read a victim's private chat messages by combining the XSS with the shared token cookie.
What the attacker needed
Reflected XSS on a subdomain; victim visits attacker's link; token cookie readable by scripts
How it was found
- Find a reflected XSS on an old subdomain of the target.
- Notice the CSRF token cookie is shared across all subdomains and readable by JavaScript.
- Use the XSS to read the token from the cookie.
- Open a WebSocket connection to the main application passing the token, and capture incoming chat messages.
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) lets an attacker run their own JavaScript in another user's browser on a site. Here a forgotten old subdomain had this flaw, and because a login-related cookie was shared across every subdomain and readable by scripts, the attacker's code could grab it and use it to connect to the chat service as the victim. That let the attacker read private messages.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.