Beyond Alert Boxes: Exploiting DOM XSS for Full Account Takeover
The articleId parameter was handled unsafely in client-side JavaScript, allowing script injection into the DOM. An attacker could use this to read authentication tokens and session IDs from API responses, leading to account takeover.
Published on ehteshamulhaq198.medium.com
Free Article Link: Click for free!
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 articleId parameter was inserted into a JavaScript context in the DOM without proper encoding or sanitisation.
Impact
An attacker could steal authentication tokens and session IDs, enabling full account takeover and access to personal and financial data depending on the stolen session's permissions.
What the attacker needed
Victim clicks a crafted link; victim is logged in
The fix
The article does not state that the issue was fixed; it recommends avoiding direct DOM manipulation with user input and sanitising data with a library such as DOMPurify.
How it was found
- Log in to the application so the browser holds a valid session.
- Open the preview URL with the articleId parameter set to a crafted value.
- The injected script runs in the page and fetches the token endpoint.
- The response is shown in a prompt, revealing the authentication token.
- Repeat with a second payload to fetch the session ID endpoint.
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 web page took a value from the address bar and put it straight into the page's code without checking it. That let an attacker run their own JavaScript in the victim's browser. The script could then read the victim's login token and session ID, which is enough to take over the account.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.