(cross domain) Iframe breakes scope on location.reload
A page containing nested cross-domain iframes fails to reload when location.reload() is triggered a second time; instead the content of the innermost iframe is displayed in place of the top-level page. The reporter also states the behaviour can be used to read an autofilled username from a page.
Originally disclosed on Mozilla
- Fixed in 3 months
- Paid in 4 months
- Disclosed after 3 months
Created attachment 8817863
ff-iframes-break-scope.zip
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36
Steps to reproduce:
Please open ff-iframe-break-scope.zip in the attachment to reproduce the bug.
I have a website (index.html). On that website i include Iframe 1 (iframe-1.html) with <iframe ...>. Also there is a link to reload the page with location.reload().
In Iframe 1 (iframe-1.html) there I create a new Iframe with document.createElement.
In Iframe 2 (iframe-2.html) I create another new Iframe. I have a Iframe Element without src-attribute in the page. And after a timeout I Iframe-Element gets a Source.
Iframe 3 only contains some HTML.
---
Important: This bug also works with 3rd party (cross domain) Iframes. In online advertising this is not a unusal construction. In ff-get-username.zip I use this bug to get the autofill username from a page. Just start with step-1.html.
Actual results:
If I press the "Click me" link twice, the page doesn't reload. Instead the Content from the last Iframe ist shown.
Expected results:
The page should reload.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely a browser bug in how the reload is handled when the frame tree contains dynamically created, cross-domain nested iframes, causing the reload to target the wrong frame.
Impact
The top-level page may fail to reload and instead display attacker-controlled frame content, and the reporter claims this could be used to obtain an autofilled username from a page.
What the attacker needed
Victim visits a page with nested iframes; user clicks a reload link twice; cross-domain iframes allowed
How it was found
- Open the attached test archive and load the main page.
- The main page embeds a first iframe, which creates a second iframe, which creates a third iframe without a source that later receives one.
- Click the link that calls location.reload().
- Click the same link a second time and observe that the page does not reload but shows the last iframe's content.
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 report has not been written yet. The Original tab links to the source.
A web page can embed other pages inside frames, and those frames can be nested several levels deep. Normally asking the browser to reload the top page should replace everything with a fresh copy of that page. Here, after reloading once, a second reload request instead showed the innermost embedded page, which means the browser lost track of which page it was supposed to be showing.
What is Misconfiguration?
Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.