Skip to content
XSS Write-up Beginner

Facebook stored XSS

The Facebook badges page saved the 'layout' request parameter into a database and later inserted it unencoded into a div's class attribute, allowing stored HTML injection. An attacker could execute JavaScript in the context of a victim who visited the badge page, but the request was protected by a CSRF token and X-Frame-Options, so the attacker could not force the request.

Brett Buerhaus Follow

Published on buer.haus

The Facebook badges page was vulnerable to stored Cross-Site Scripting (XSS). This was initially reported back in August 2013, but due to communication problems over e-mail it wasn't fixed until early January.

Brett Buerhaus (@bbuerhaus), on buer.haus

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 application stored user-supplied input and later inserted it into an HTML attribute without encoding, allowing HTML injection.

Impact

The impact was small: the request was protected by a CSRF token and X-Frame-Options, so an attacker could not force a victim to save the payload; a victim would have to visit the badge page for it to execute, but then the attacker could perform actions or extract information.

What the attacker needed

Victim visits the badge page; attacker cannot force the request (CSRF token)

The fix

The badge page was completely overhauled so that a client-supplied string is no longer passed to a database and saved.

How it was found

  1. Send a POST request to the badges profile page with a crafted 'layout' parameter.
  2. The server saves the layout value to a database.
  3. When the badge page is viewed, the stored value is placed unencoded into the div's class attribute, breaking out and injecting HTML.

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 takes something you type or send and later shows it on a page without cleaning it, an attacker can sneak in extra code. Here, the 'layout' value was stored and then placed inside a page element without encoding, so an attacker could add their own HTML. That could run JavaScript in the browser of anyone who viewed the page, but the attacker could not make you send the request because it needed a secret token.

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 Brett Buerhaus

View all

8 more disclosed reports, best first.

More from Meta

View all

The newest disclosed reports for this program.

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.