Skip to content
XSS Write-up Beginner

Stored XSS in GMail

The basic HTML version of Gmail did not escape the sender name when displaying a phishing alert, so an attacker could send an email with a crafted sender name that executed script in the victim's browser. The script ran automatically when the victim opened the email, with no further interaction.

blog.miki.it

Published on blog.miki.it

Here I present a (reported and fixed) Stored XSS vulnerability I discovered in mail.google.com, which required no user interaction.

Michele Spagnuolo, on blog.miki.it

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

The sender name was inserted into the phishing alert without proper HTML escaping in the basic HTML layout.

Impact

An attacker could run script in the victim's Gmail session when the victim opened the email in the basic HTML layout, and the script would run again each time the email was reopened.

What the attacker needed

Victim uses basic HTML Gmail layout; attacker can send email with crafted sender name; victim opens the email

The fix

The vulnerability was fixed by properly escaping the sender name in the phishing alert.

How it was found

  1. Use a fake mailer or open relay that triggers the phishing alert.
  2. Send an email to the victim with a malicious sender name.
  3. Set the encoding to UTF-8.
  4. Open Gmail in the basic HTML layout.
  5. Open the received email, which triggers the script.

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 get an email, Gmail shows the sender's name. In the basic HTML version, Gmail put that name into the page without cleaning it first. An attacker could put code in the name, and that code would run in your browser when you opened the email.

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.