Stored Dom Xss
A web application stored user-supplied input without adequate sanitisation and later rendered it on other pages, so an attacker could inject HTML and JavaScript that runs in a victim's browser. The author claims this could let an attacker steal session tokens and private data or act on the victim's behalf.
I found a Stored DOM XSS vulnerability when testing the web application. The online application has an area where users may enter data to be stored in the database and presented on subsequent pages, where the vulnerability is located.
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 application saved user input without sanitising it and then inserted it into later pages without output encoding, so markup in the input was treated as code.
Impact
An attacker could steal session tokens and private data, or perform actions such as transfers and settings changes as the victim, though the report only demonstrates an alert box rather than real data theft.
What the attacker needed
A free account; victim views the page with stored input
The fix
User input should be sanitised before storage and output-encoded when rendered, with a Content Security Policy added to limit script execution.
How it was found
- Log in to the application as a regular user.
- Go to the section where data is entered and stored.
- Type a crafted value containing an image tag with an error handler into a text field.
- Submit the input.
- Open another page where the stored input is displayed.
- The browser runs the injected script and shows an alert.
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.
Many websites let you type things that are saved and shown to other people later, such as comments or profile details. If the site saves that text without cleaning it and later puts it straight into the page, any code hidden in the text runs in the browser of whoever views it. That is called stored cross-site scripting, and it lets an attacker act as the victim.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.