Skip to content
XSS Write-up Advanced

Day 9: CRLF to Account Takeover (Chaining Bugs)

A CRLF injection on one subdomain let the attacker set a cookie containing a script payload for the parent domain, and a cookie-based XSS on another subdomain executed it on the login page. The script read the browser's autocompleted username and password fields and sent them to the attacker, giving full account takeover.

medium.com

Published on medium.com

For Day 9 of my 100-day Account Takeover (ATO) challenge, I’m sharing an interesting write-up by MoSec on how a CRLF injection vulnerability led to a full account takeover by chaining multiple bugs together.

dani3l, on medium.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 line breaks in a URL path before writing it into response headers, and a separate subdomain reflected a cookie value into the page without encoding it.

Impact

The attacker could obtain the victim's saved login credentials and take over the account; the report was rated high severity.

What the attacker needed

Victim clicks a crafted link; victim has saved credentials in browser; autocomplete enabled on login form

How it was found

  1. The attacker sends the victim a crafted URL on the CRLF subdomain that injects a cookie scoped to the parent domain.
  2. The victim then visits the second subdomain, which redirects to the login page.
  3. The stored XSS on the login page runs the injected script.
  4. The script reads the autocompleted username and password fields and sends them to the attacker's server.

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.

CRLF injection means sneaking line-break characters into a web request so the server treats part of your input as a new header, here letting the attacker plant a cookie. A cookie-based XSS means a value stored in a cookie is later placed into a page without cleaning, so a script inside it runs in the victim's browser. Because the login form had autocomplete on, the browser filled in the saved password, which the script then read and sent away.

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.