New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 705583 link

Starred by 4 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Chrome , Mac
Pri: 3
Type: Bug



Sign in to add a comment

Sandboxed iframe w/o top nav permission can still navigate the parent page

Project Member Reported by dvoytenko@google.com, Mar 27 2017

Issue description

Chrome Version: (copy from chrome://version)
OS: (e.g. Win7, OSX 10.9.5, etc...)

macOSX 10.12.2 (16C67)
Chrome: 59.0.3048.0 canary (64-bit)

What steps will reproduce the problem?
(1) Create a page with with `<iframe sandbox="allow-scripts">`. Notable is that sandbox doesn't specify "allow-top-navigation".
(2) Call `window.back()` from the sandboxed iframe

What is the expected result?

Top window context should not be navigated by the iframe.

What happens instead?

Top window is navigated back and out of the current page.

This is possibly a spec issue, or at least a spec-clarification issue. It'd be nice to have a way (or sandbox flag or an `allowhistory` iframe attribute) to provide some level of isolation from a child iframe, such as an ad. While the security attack opportunities are limited, there are some accidental history API misuses that can break parent page's UX.
 

Comment 1 by ojan@chromium.org, Mar 29 2017

Cc: binlu@chromium.org japhet@chromium.org ojan@chromium.org
Here's a test case:
<div id="container"></div>
<script>
  container.innerHTML =
    '<iframe sandbox="allow-scripts allow-modals" srcdoc="<script>history.forward()</scr' + 'ipt>">';
</script>

1. Load that in a page.
2. Navigate to another page.
3. Hit back.

The sandboxed iframe renavigates you forward.

This does seem like a violation of disallowing top-navigation to me. Maybe it should just error?

It doesn't have quite the same security concern though since the attacker can't control what page you get sent to.
I believe w/o `allow-top-navigation` iframe shouldn't be able to affect parent's stack. I don't think it's an error though. It could just be considered that the iframe is at the "bottom" of the history stack.

Comment 3 by ojan@chromium.org, Mar 29 2017

I don't know what you mean by being at the bottom.
I mean that API could work as if iframe's history stack is simply at the very first entry - i.e. not possible to go back anymore.

Comment 5 by dk...@chromium.org, Apr 4 2017

Ping! Who do we think is the right owner for this? @Mike, would this be a security bug?

Comment 6 by dk...@chromium.org, Apr 10 2017

Cc: -mkwst@chromium.org
Owner: mkwst@chromium.org
Assigning to Mike to see if we can move the triage for this along.

Comment 7 by mkwst@chromium.org, Apr 11 2017

Cc: mkwst@chromium.org alex...@chromium.org creis@chromium.org
Components: UI>Browser>Navigation Blink>SecurityFeature>IFrameSandbox
Labels: OS-Android OS-Chrome OS-Linux OS-Mac OS-Windows
Owner: ----
Status: Available (was: Untriaged)
As noted above, the security implications are minimal: the attacking frame can't control where you go, it can only send you to places you've already been. That said, it does seem like a violation of the expectations around `allow-top-navigation`. I don't have strong opinions about how to block the navigation entirely, but I do think that's a reasonable thing to do. It would be interesting to check what Firefox/Edge do in this scenario. Perhaps we can replicate their behavior if it's more sane than ours?

CCing some //content folks who know more about navigation than I do. :)
Project Member

Comment 8 by sheriffbot@chromium.org, Jul 21 2017

Labels: Hotlist-Google

Comment 9 by est...@chromium.org, Nov 10 2017

Labels: Hotlist-EnamelAndFriendsFixIt
Labels: -Hotlist-EnamelAndFriendsFixIt

Comment 11 by ojan@chromium.org, May 8 2018

Cc: -ojan@chromium.org
Answering to: "It would be interesting to check what Firefox/Edge do in this scenario. Perhaps we can replicate their behavior if it's more sane than ours?"

I tested all my browsers, and they all behave the same:
- Firefox Developer Edition 61.0b13 (64-bit)
- Firefox Quantum (stable) 60.0.2 (64-bit)
- Google Chrome 67.0.3396.87 (Official Build) (64-bit)
- Google Chrome 69.0.3452.0 (Official Build) dev (64-bit) (includes the behavior for "by-user-activation" announced here: https://blog.chromium.org/2018/06/chrome-68-beta-add-to-home-screen.html)
- Microsoft Edge 42.17134.1.0 (Microsoft EdgeHTML 17.17134)
- Microsoft Internet Explorer 11.112.17134.0

They all allow this kind of navigation.

I encountered this (in my eyes buggy) behavior while adding a sandbox to the iframes we include in our webapp. We run a chat website were we allow users to write own webapps that we include for all users in the current channel. To protect our users from potentially evil app developers or evil webapps we count on the iframe-sandbox feature. But with this navigation back from inside a sandboxed iframe (almost) any user can manipulate the website from any user in the channel. So for us this definitely an issue we want to see solved.
I'd recommend the proposed solution with a new allow-history flag for the sandbox, with blocked outside-iframe-navigation as the default.

And another question, since this is my very first involvement in an issue like this that exists across browsers: Who and how will the other browser vendors be informed about this issue? Will you work together with them to come up with a solution that will ship in every browser?
I found two issues in the Firefox bugzilla that seem to be related:
https://bugzilla.mozilla.org/show_bug.cgi?id=690366
https://bugzilla.mozilla.org/show_bug.cgi?id=1225637

Sign in to add a comment