My $3k Chromium Bug Bounty

In October I reported to Chromium what I thought was a bug and security issue in how Chrome handles <iframe sandbox>.

Turns out, Google agreed, fixed it in Chrome 80, which came out this week, and awarded me a $3,000 bug bounty for it, which was a really nice surprise. It even got its own CVE (CVE-2020-6394).

The bug

Say you show untrusted HTML in an iframe with the sandbox attribute. You leave out allow-scripts, so no script should run, but you allow links to open in a new tab and let the parent page read the iframe’s document:

<iframe
  sandbox="allow-same-origin allow-popups allow-popups-to-escape-sandbox"
  srcdoc="UNTRUSTED_CONTENT"
></iframe>

It turned out the untrusted content could still run JavaScript. All it needed was a target="_blank" link with a javascript: URL that reaches back through window.opener:

<a target="_blank" href="javascript:window.opener.eval('alert(location.href)')">click me</a>

Clicking that link ran script back in the sandboxed iframe, the very frame that wasn’t allowed to run script. With allow-same-origin it got worse: window.opener.parent reached the parent page, so the untrusted content could read the parent page’s cookies or redirect it somewhere else, even though allow-top-navigation wasn’t set.

Safari blocked both cases, but Firefox had the same problem as Chrome, so I reported it there too.

The fix

The developers agreed that a sandboxed frame without allow-scripts shouldn’t be able to cause script to run at all. Mike West opened a change to the HTML spec and landed a fix in Chromium that stops sandboxed frames from navigating to javascript: URLs.

In January the reward panel awarded $3,000, and the fix shipped in the Chrome 80 stable release on February 4, 2020, which lists my bug:

[$3000][1014371] Medium CVE-2020-6394: Insufficient policy enforcement in Blink. Reported by Phil Freo on 2019-10-15


Update (September 2021): This bug is related to how I built Close to display untrusted synced HTML emails in the CRM, which uses this same iframe sandbox technique (allow-same-origin lets us resize the iframe to fit the email’s height, so there’s no second scrollbar). Once this bug was discovered, we added extra guardrails so the sandbox wasn’t our only line of defense. I wrote up the whole approach here:

Rendering untrusted HTML email, safely

How Close safely displays synced HTML email inside its web app, without HTML sanitization: a sandboxed srcdoc iframe plus a Content Security Policy, so no JavaScript in an email can ever run.

Phil Freo · September 29, 2021