DOM-XSS in Instant Games due to improper verification of supplied URLs
A shared URL-navigation helper used across Meta platforms failed to confirm that the value it received was a genuine URI object, so an array containing a javascript URI slipped past the scheme check and was assigned to window.location. An attacker who hosted a malicious Instant Game could send crafted cross-window messages to trigger DOM-based cross-site scripting and potentially take over the victim's Facebook or Meta account.
localhost
Published on localhost
The original lives on localhost
We do not hold its text, 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 helper trusted any non-string value as an already-validated URI object and called toString() on it without checking it was actually an instance of the URI class, so an array wrapping a javascript URI bypassed the scheme allow-list.
Impact
An attacker could run script in the Facebook origin and potentially take over the victim's Facebook or Meta account, though the described path requires the victim to click a dialog.
What the attacker needed
Attacker hosts an Instant Game; victim plays the game; victim clicks a dialog
How it was found
- Host a malicious Instant Game whose page sends cross-window messages to the parent frame.
- Send a showgenericdialogasync message with the request set to open_external_link.
- Get the victim to click the resulting dialog so the crafted value reaches the navigation helper.
- The helper assigns the javascript URI to window.location and the script runs in the Facebook origin.
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.
Websites often have a small helper that sends the browser to a new address. This one tried to block dangerous addresses (like ones starting with javascript:) but only checked the type of the value loosely, so a cleverly shaped value got through. When the browser followed that address, the attacker's code ran inside Facebook's page, which can lead to the account being taken over.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.