The tricky XSS
A stored cross-site scripting vulnerability existed in the address nickname field of an online store, but input length was limited to 20 characters. The attacker used a short payload referencing an external script to execute JavaScript and steal cookies, though the report was closed as self-XSS and not fixed.
Published on smaranchand.com.np
Hello everyone, I would like to share a riveting issue regarding XSS (Cross-Site Scripting ) I endured a few months ago. Cross-site scripting (XSS) is a type of security vulnerability typically found in web applications.
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 address nickname field did not properly sanitise or encode user input before reflecting it in the page.
Impact
An attacker could execute arbitrary JavaScript in the context of a victim's browser and steal cookies, but the report was closed as self-XSS and the XSS never executed in the admin dashboard.
What the attacker needed
Victim must save the payload in their own address; attacker needs a short domain
How it was found
- Enter a short HTML tag in the address nickname field and save.
- Click the delete address button to see the input reflected.
- Try a JavaScript payload but discover a 20-character limit enforced server-side.
- Use a short script tag pointing to an external domain to execute JavaScript.
- Host a script on that domain that reads document.cookie and sends it to a remote server.
- Confirm the payload executes and cookies are received.
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) is when a website lets an attacker sneak in JavaScript code that runs in other users' browsers. Here, the address nickname field saved the code and showed it later, but only allowed 20 characters, so the attacker used a very short script hosted on their own domain to run code and steal cookies (small pieces of data that can identify a logged-in user).
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.