Skip to content
Account takeover Write-up Advanced

Account Takeover in Canvas Apps served in Comet due to failure in Cross-Window-Message Origin validation

The Comet Canvas dialog broker trusted a MessageChannel port sent from a sandboxed iframe whose origin parsed as the string 'null', because the origin comparison was called in the wrong direction and all protocol, domain and port checks were skipped. An attacker could then receive the dialog URL with its state and cquick_token, and use the leaked state to make the parent window accept an OAuth response for a first-party app, leading to account takeover.

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 origin comparison was inverted (the untrusted origin was asked whether it is the same origin as the trusted one, rather than the reverse), and a null origin parsed into an object with empty protocol, domain and port so every check passed.

Impact

An attacker could take over a Facebook or Meta account if the user played a Canvas game, though the report does not show a full end-to-end demonstration.

What the attacker needed

Victim plays a Canvas game; attacker controls a Canvas app; sandboxed iframe with null origin; guessed iframeKey

How it was found

  1. Host a sandboxed iframe so its origin is reported as null.
  2. Send a CompatSetup message with a guessed iframeKey and a MessageChannel port to the parent window.
  3. Use the accepted port to request the dialog URL and read the leaked state and cquick_token.
  4. Build a new dialog/oauth request for a first-party app with the leaked state and redirect to the arbiter return path.
  5. Frame that request using the leaked cquick_token so the frame is allowed.
  6. Let the parent window accept the returned access token or code as if it came from the attacker's own app.

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.

A web page can talk to another page inside it using messages, and it is supposed to check who sent each message. Here the check was written backwards, so a page with no real origin (a sandboxed frame) was treated as trusted. That let an attacker slip into a private conversation channel and steal a login token.

What is Account takeover?

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.

Similar reports

View all

Same bug class and techniques, clearest first.

Account takeover

The lesson behind this report.

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.