Skip to content
XSS Write-up Intermediate

Case Study: Stored XSS to Account Takeover

A stored cross-site scripting vulnerability in the email signature feature of EspoCRM allowed an attacker to execute JavaScript when a victim replied to or forwarded an email. This enabled theft of non-HttpOnly cookies used to build the authentication token, leading to account takeover.

admin Follow

Published on gauravnarwani.com

Hello Guys, recently I encountered with some Stored XSS on a web application which helped me takeover any account on the application. A bunch of CVE’s were assigned for the Stored XSS which you can find in my Publications page.

admin, on gauravnarwani.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 email signature's markdown code view allowed HTML injection and the sanitiser failed to block a polyglot payload that used an SVG onload handler, while authentication cookies were not marked HttpOnly.

Impact

An attacker could steal an admin's cookies and construct the authentication token, leading to full account takeover; the text does not mention any defence that limited the exploit.

What the attacker needed

Victim replies to or forwards an email; attacker can send email to victim; victim uses the web application

How it was found

  1. Navigate to the preference tab and open the email signature code view.
  2. Insert a polyglot XSS payload into the code view.
  3. Save the signature; the payload is stored and executes when the signature is rendered.
  4. Send an email to the victim; when the victim replies or forwards, the stored XSS fires.
  5. The JavaScript steals the victim's cookies, allowing construction of the authentication token and account takeover.

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.

Cross-site scripting (XSS) is when an attacker sneaks harmful code into a trusted website, so it runs in another user's browser. Here, the email signature feature let a specially crafted piece of code stay saved and run when someone replied to an email. Because the site stored login information in cookies that JavaScript could read, the attacker could steal that information and log in 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.

More by admin

View all

6 more disclosed reports, best first.

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.