From Curiosity to Report: My First Bug on a Live E-commerce Site
The username field on a personal information page accepted HTML tags without sanitisation, and the stored value was rendered as HTML in a password reset email. An attacker could inject a link into that email, which a recipient might click and be taken to an attacker-controlled site.
medium.com
Published on medium.com
It was 3 AM, and I was still staring at my screen, determined to find a bug. While crawling through various sites, I stumbled upon an e-commerce platform — let’s call it “target.com.”
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 the username without sanitising HTML and later rendered it unescaped in the password reset email.
Impact
An attacker could inject a link into the password reset email, and a recipient who clicked it would be taken to an attacker-controlled site; the report does not claim script execution or account takeover.
What the attacker needed
A user account on the site; ability to change the username; victim opens the password reset email
The fix
The application should sanitise or escape user-supplied input before storing it and before rendering it in emails, rather than relying on a WAF.
How it was found
- Find the change personal information page on the target site.
- Enter HTML tags such as a heading in the username field and save.
- Trigger a password reset email to the account.
- Observe that the username appears in a larger font, confirming HTML injection.
- Replace the heading with an anchor tag pointing to an external site and save.
- Trigger another password reset email and see the rendered link.
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.
When a website lets you type text, it should treat that text as plain characters, not as instructions for the browser. Here the site saved HTML tags in a username and later put them into an email without cleaning them, so the email showed a clickable link chosen by the attacker. This is called HTML injection, a cousin of cross-site scripting, and it can be used to trick people into visiting harmful sites.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.