I Tried Filling Out a Simple Contact Form and Discovered a Stored
A contact form stored user-supplied HTML and JavaScript without sanitisation, and the payload executed when the submission was displayed. An attacker could run script in the context of the site, potentially stealing cookies or redirecting users.
It was just another night — me, a cup of coffee, and my usual hobby: poking around websites to see how they handle user input. Nothing fancy, nothing evil, just curiosity.
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 stored raw user input and rendered it without output encoding or sanitisation.
Impact
An attacker could steal cookies or sessions, redirect users to fake pages, inject phishing content, or control what visitors see on the site.
What the attacker needed
Ability to submit the contact form
The fix
The site should sanitise user input, escape outputs so data is treated as text, and use a strong content security policy.
How it was found
- Open the contact form page.
- Enter a name containing HTML and JavaScript.
- Submit the form.
- View the submission where it is displayed and observe the script executing.
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.
A contact form saved whatever the user typed and later showed it back without cleaning it. Because the saved text included HTML and JavaScript, the browser ran it as if it were part of the website. This is called stored cross-site scripting (XSS): malicious code is stored on the server and runs for anyone who views the page.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.