Skip to content
UI spoofing Disclosed report Intermediate CVE-2017-7791

Firefox allows you to insert confirm/alert/prompt dialog in any domain

A permission prompt shown by Firefox was not dismissed when the top-level window navigated to a different site, so the dialog stayed visible over the new page. An attacker could use this to display a convincing confirm, alert or prompt dialog on any domain the victim visits.

Jose María Acuña Follow

Originally disclosed on Mozilla

  • Fixed in 40 days
  • Paid in 53 days
  • Disclosed after 40 days
Text
Created attachment 8868929
permission-prompt.webm

User Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36

Steps to reproduce:

1- Go to http://createcharts.esy.es/permission-prompt.html
2- Click button

Tested in:

Firefox Nightly 55.0a1 (2017-05-17) (64-bit)
Firefox Developer Edition 54.0a2 (2017-04-18) (32-bits)
Firefox 53.0.2 (32-bit)




Actual results:

Permission Prompt not correctly dismissed on top window navigation

The original report as published on Mozilla's Bugzilla, by Jose María Acuña. Images and videos are our own copies; raw HTML is shown as text. View it on Mozilla's Bugzilla.

The original is short, so this covers everything it reports, then explains this kind of bug in general: how it works, how to test for it and how it is fixed. The general sections are about the bug class, not this target. Written with AI and checked against the original; the original is the record. 4 min read.

What the report shows

The target is Firefox's permission prompt handling, filed under Mozilla's notifications and alerts area. The researcher, Jose María Acuña, reported that a permission prompt is not correctly dismissed when the top window navigates. The report is rated medium severity and classified as spoofing.

The reproduction is short. The researcher hosted a page and gave these steps:

  1. Go to http://createcharts.esy.es/permission-prompt.html
  2. Click button

The page is a plain HTTP URL on a third-party host, and the only interaction required is a single button click. The report does not describe what the button does or which permission the prompt requests.

The behaviour was reproduced on three builds:

Build Version Architecture
Firefox Nightly 55.0a1 (2017-05-17) 64-bit
Firefox Developer Edition 54.0a2 (2017-04-18) 32-bit
Firefox 53.0.2 32-bit

The user agent string supplied with the report is:

Text
Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36

That string identifies Chrome, not Firefox, so it does not match the browsers listed as tested. The report does not explain the discrepancy.

The stated actual result is a single line: the permission prompt is not correctly dismissed on top window navigation. A screen recording, permission-prompt.webm, was attached to the report. The report does not include a bounty amount, a CVSS score or a fix description.

Root cause

The report states only that the permission prompt is not correctly dismissed when the top window navigates. When the top-level window navigates away, the prompt belonging to the previous page is expected to be torn down with it. The prompt is not correctly dismissed on top window navigation.

Impact

The consequence is spoofing. A prompt that is not dismissed on navigation may mislead the user about which page it belongs to. A user who trusts the visible address bar could be misled about which origin is asking for a permission.

Treat the impact as limited to user deception unless further evidence is produced.

How this kind of bug works

Permission prompts are part of the browser's trusted UI. They are rendered outside the page so that web content cannot draw them, and they are supposed to be bound to the requesting origin. The binding has two parts: the prompt records which origin asked, and the browser cancels the prompt when that origin's document goes away.

Bugs appear when the second part fails. Navigation, history traversal, tab replacement, frame removal and window closing are all events that should invalidate pending prompts. If any of these paths skips the cancellation step, the prompt stays alive with stale origin information. Because the prompt is trusted UI, whatever it displays is believed by the user, and the mismatch between the displayed origin and the actual top-level site is the spoof.

Defences are structural: prompts should be owned by the document or browsing context that requested them, cancelled on any teardown of that context, and re-validated against the current top-level origin before they are shown or acted upon.

How to test for it

  1. Identify features that raise browser-level UI: permission requests, authentication dialogs, download confirmations, protocol handlers and similar.
  2. Trigger the prompt on an attacker-controlled page, then navigate the top window to a different origin before answering it. Use a scripted redirect, a link click or a location change.
  3. Observe whether the prompt persists after the new page has loaded, and whether it still names the original origin or appears to belong to the new one.
  4. Repeat across navigation types: full page load, same-document navigation, history back and forward, and closing or replacing the tab.
  5. Test on multiple builds, since prompt handling changes between release, beta and nightly channels.

A positive result is a prompt that remains visible and actionable after the top-level origin has changed, especially if the dialog's text or origin indicator no longer matches the page underneath. Record the sequence on video, as the researcher did here.

Common false positives: the prompt is correctly cancelled but the recording shows a repaint delay; the navigation did not actually complete before the observation; the prompt belongs to a subframe that legitimately persists; or the browser shows a generic dialog that carries no origin information, so no deception is possible.

How it is fixed

Standard fixes bind the prompt to its requesting browsing context and cancel it on teardown. Concretely: register pending prompts with the document or inner window, drop them on navigation, unload or frame destruction, and re-check the current top-level origin before displaying or accepting a response. Regression tests should cover navigation away from a page with an open prompt on each channel.

Hunting notes

This class tends to hide in the seams between content and browser chrome: permission managers, modal dialogs, authentication prompts, download and protocol-handler confirmations, and anything that survives a tab or frame lifecycle event. Recon signals include recent refactors of prompt or permission code, bugs mentioning stale state after navigation, and features that keep UI alive across page loads.

The report included a video and a reproduction page.

The original is short, so this covers everything it reports, then explains this kind of bug in general: how it works, how to test for it and how it is fixed. The general sections are about the bug class, not this target. Written with AI and checked against the original; the original is the record. 6 min read.

What happened, in plain words

Firefox, like every browser, sometimes needs to ask you for permission. A website might want to show you notifications, use your location or access your camera, and before that happens Firefox shows a small dialog asking whether you agree. That dialog is drawn by the browser itself, not by the website, so you are meant to be able to trust it: it tells you which site is asking.

The researcher, Jose María Acuña, found that this trust could be broken. If a permission dialog was open and the main window then navigated, the dialog was not properly dismissed. The report is rated medium severity and classified as spoofing, which simply means pretending to be something you are not.

The report does not say which permission the dialog was asking for, or what the button on the test page did.

What the report shows

The researcher put a test page online and gave two steps to reproduce the problem:

  1. Go to http://createcharts.esy.es/permission-prompt.html
  2. Click button

That is the whole recipe. The page is served over plain HTTP from a third-party host, and the only thing you have to do is click one button. The report does not describe what happens when you click it, beyond the result described below.

The behaviour was seen on three different builds of Firefox:

Build Version Architecture
Firefox Nightly 55.0a1 (2017-05-17) 64-bit
Firefox Developer Edition 54.0a2 (2017-04-18) 32-bit
Firefox 53.0.2 32-bit

Nightly and Developer Edition are the experimental channels where new code appears first; the third is the ordinary release version. The same result was seen on all three builds.

The report also includes a user agent string, which is the short line of text a browser sends to every website to identify itself:

Text
Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36

Read it piece by piece: Windows NT 6.3 says the machine runs Windows 8.1, Win64; x64 says it is a 64-bit system, and the words Chrome/58.0.3029.110 identify Chrome, not Firefox. So this string does not match the browsers listed as tested.

The stated result is one line: the permission prompt is not correctly dismissed on top window navigation. In other words, when the main window moves to another page, the dialog that belonged to the old page should disappear with it, and it does not. A screen recording named permission-prompt.webm was attached to show the sequence, because the timing is the whole point. The report gives no bounty amount, no CVSS score and no description of a fix.

Why it happens

A permission dialog is supposed to be tied to the page that asked for it. Think of a cloakroom ticket: the coat is handed back only to the person holding the matching ticket, and when the event ends the cloakroom closes. Here, the browser is meant to remember which site raised the dialog and to throw the dialog away when that site's page goes away.

What it means for users

The effect is deception. A dialog that is not dismissed on navigation may mislead the user about which page it belongs to. Someone who trusts what they see could be misled about who wants the permission.

Until more evidence appears, treat the impact as limited to fooling the user.

In general, how this kind of bug works

Permission prompts belong to what security people call trusted UI: parts of the screen drawn by the browser, outside the page, so that a website cannot fake them. The trust rests on two things. First, the prompt records which site asked. Second, the browser cancels the prompt when that site's page disappears.

Bugs appear when the second part fails. Moving to another page, going back or forward in history, replacing a tab, removing a frame and closing a window are all moments when a waiting prompt should be cancelled. If any of those paths skips the cancellation, the prompt stays alive with out-of-date information about who asked. Since users believe trusted UI, a prompt that no longer matches the page underneath is the spoof.

The defence is structural: a prompt should belong to the page that requested it, be cancelled whenever that page is torn down, and be checked against the current top-level site before it is shown or answered.

In general, how to test for it

  1. Find features that raise browser-level dialogs: permission requests, login dialogs, download confirmations, protocol handlers and similar.
  2. Trigger the dialog on a page you control, then move the main window to a different site before answering it, using a redirect, a link or a script that changes the address.
  3. Watch whether the dialog survives after the new page loads, and whether it still names the original site or seems to belong to the new one.
  4. Repeat with different kinds of navigation: a full page load, a change within the same page, back and forward, and closing or replacing the tab.
  5. Test on several builds, because dialog handling changes between release, beta and nightly channels.

A positive result is a dialog that stays visible and usable after the top-level site has changed, especially if its text or site indicator no longer matches the page behind it. Record the sequence on video, as the researcher did here.

Common false positives: the dialog was cancelled correctly but the recording shows a slow redraw; the navigation had not actually finished when you looked; the dialog belongs to a subframe that legitimately stays; or the browser shows a generic dialog with no site information, so no deception is possible.

In general, how it is fixed

Standard fixes tie the prompt to the page that requested it and cancel it when that page goes away. In practice: register waiting prompts with the page, drop them on navigation, unload or frame destruction, and re-check the current top-level site before showing the prompt or accepting an answer. Regression tests should cover navigating away from a page with an open prompt on every channel.

In general, where to look

This class of bug hides in the seams between page content and browser interface: permission managers, modal dialogs, login prompts, download and protocol-handler confirmations, and anything that survives a tab or frame lifecycle event. Useful signals are recent rewrites of prompt or permission code, bugs mentioning stale state after navigation, and features that keep interface alive across page loads.

The report included a video and a reproduction page.

Glossary

  • Permission prompt: a dialog drawn by the browser asking whether a site may use something such as notifications, location or the camera.
  • Spoofing: pretending to be something you are not, here making a dialog look like it belongs to a site that did not ask.
  • Top window / top-level navigation: the main page shown in the browser window, and the act of moving it to another address.
  • Origin: the combination of scheme, host and port that identifies a website, for example http://createcharts.esy.es.
  • User agent string: the line of text a browser sends to identify itself, its version and its operating system.
  • Build / channel: a particular compiled version of the browser; Nightly and Developer Edition are early test channels, release is the ordinary one.
  • Trusted UI: interface drawn by the browser rather than the page, so websites cannot imitate it.
  • Browsing context: a place where a page is displayed, such as a tab or a frame.
  • Frame / subframe: a page embedded inside another page.
  • Lifecycle event: a moment in a page's life such as loading, navigating away, unloading or being destroyed.
  • Stale state: information kept after it should have been thrown away, such as a prompt remembering a page that is gone.
  • False positive: a test result that looks like a bug but is not one.
  • Regression test: an automated test that checks a fixed bug stays fixed.
  • CVSS: a standard scoring system for the severity of a security flaw.
  • Bounty: a payment some organisations give researchers for valid reports.

More by Jose María Acuña

View all

2 more disclosed reports, best first.

More from Mozilla

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Clickjacking and UI spoofing

The lesson behind this report.

The interface lies to the user: a framed page catches their clicks, or a browser shows the wrong address or a fake prompt. Paid when it leads to a sensitive action or convincing phishing.