Skip to content
XSS Write-up Advanced

Hacking Facebook with FBML and DOM

Facebook's canvas sandbox let an app traverse the DOM of elements Facebook rendered inside the app's own container, so a public canvas page could read profile information about users who had not added the app. The same traversal allowed the app to change the source of Facebook's FBJS bridge Flash object to an attacker-controlled SWF, which had unrestricted script access and so gave full script control.

Matt Austin Follow

Published on maustin.net

Facebook allows developers to build applications using the “Canvas“. Because the canvas apps run on the facebook domain they use a “Sandbox”.

Matt Austin (@mattaustin), on maustin.net

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 sandbox relied on blocking direct access to Facebook-rendered elements, but DOM traversal from an app-owned wrapper element reached them anyway, including the bridge Flash object that was deliberately given full script access.

Impact

An app could read information about users who had not added it and, through the swapped bridge Flash file, run unrestricted script in the canvas, potentially against all users rather than only those who had joined the app.

What the attacker needed

A Facebook canvas app; a public canvas page; attacker-hosted SWF file

How it was found

  1. Create a public canvas page so the app can be served to users who have not added it.
  2. Place Facebook widgets such as the profile picture and multi-friend selector inside a div the app controls.
  3. Use FBJS element traversal functions to reach those widgets and read their contents.
  4. Use the same traversal to change the source of the FBJS bridge Flash object to an attacker-owned SWF.
  5. Gain unrestricted script access through the swapped Flash file.

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.

Facebook apps ran inside a restricted area on Facebook's own pages, meant to stop app code from touching anything Facebook put there. The researcher found that wrapping Facebook's own widgets in a container the app created let the app's limited JavaScript reach into those widgets anyway. That meant it could read user details and also swap out a Flash file that was allowed to talk to JavaScript freely.

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 Matt Austin

View all

5 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.