Stored XSS on Facebook.
Stored XSS vulnerabilities existed in Facebook's handling of Open Graph video metadata, allowing an attacker to inject malicious JavaScript that executed when a victim played an embedded video. The attacker could run arbitrary script in the context of facebook.com.
Meta
Published on opnsec.com
I reported multiple stored XSS on Facebook wall in April 2017. These stored XSS vulnerabilities were also present in WordPress so I waited for WordPress to patch it before publishing this write-up.
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 inserted attacker-controlled Open Graph video URLs into the DOM without proper encoding, and relied on browser URL parsing that differed across browsers, leading to script injection.
Impact
An attacker could execute arbitrary JavaScript in the context of facebook.com, potentially leading to account compromise or data theft.
What the attacker needed
Victim clicks play on a crafted post; attacker can post a URL with OG tags
The fix
Facebook fixed the issues by modifying the Flash file to avoid setTimeout, escaping double quotes in the Vimeo iframe code, and eventually removing the MediaElement component.
How it was found
- Attacker posts a URL on Facebook with malicious Open Graph meta tags.
- Facebook fetches the URL and reads the og:video:type and og:video:secure_url tags.
- Victim views the post and clicks the play button.
- Facebook loads the video using the attacker-supplied URL, triggering the XSS.
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 share a link on Facebook, Facebook reads special tags from that page to show a preview, like a video player. The code that built that player didn't properly clean up some values, so an attacker could sneak in JavaScript that runs when someone clicks play. This let the attacker run code as if it were Facebook itself.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.