Skip to content
XSS Write-up Intermediate

How I Leveraged HTML Injection to Create an Account Using Someone Else’s Email

The registration form's first name field was not sanitised, allowing HTML injection into the verification email. An attacker could inject an image tag that sent the victim's verification token to an attacker-controlled server when the email was opened, enabling account creation with someone else's email.

infosecwriteups.com

Published on infosecwriteups.com

In the realm of web security, vulnerabilities can manifest in various forms, often leading to unintended access or control over user accounts. One such vulnerability is HTML injection, which can be exploited to manipulate web applications in unexpected ways.

Devansh Doshi, on infosecwriteups.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 failed to sanitise or encode user-supplied input (the first name) before embedding it in the HTML body of the verification email.

Impact

An attacker could steal a victim's verification token and create an account using the victim's email address, potentially leading to account takeover or impersonation.

What the attacker needed

Victim opens the verification email; attacker controls a server to receive token

The fix

The application should sanitise and encode dynamic input fields, especially in sensitive processes like email verification.

How it was found

  1. Register on the site and note that the verification email includes the first name.
  2. Test the first name field with HTML and observe that it is rendered in the email.
  3. Discover that the placeholder {token} is replaced with the verification token in the email.
  4. Craft an image tag pointing to an attacker server with the token in the query string.
  5. Submit the registration with the malicious first name and wait for the victim to open the email, which sends the token to the attacker.

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 you sign up, the site puts your name into a welcome email. If the site doesn't clean that name properly, an attacker can put special code (HTML) in the name field. That code runs when the email is opened, and can secretly send a secret link (the verification token) to the attacker, letting them finish signing up as you.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.