Browsers generally include click-jacking protection for their internal popups. For example to keep you from accidentally opening a downloaded file without realizing what you are doing.
However, in the scenario you describe, the responsibility of protection is at the site that hosts the Allow Access button. (in this case, Google) There is no 100% fooluser-proof solution. So, unfortunately part of this has to be general anti-phishing initiatives. (Google tries to database malicious sites, but this is a reactionary system.)
The most simple form of click-jacking is of course page navigation, or a plain popup triggered by the first of the two clicks. Popup blockers do not take effect when the popup is triggered directly by a user's click, and of course the popup blockers do not stop plain navigation.
Is there any way a site can protect against it?
Does Google include a minimum time before the approve button begins to function?
It just so happens the page at Google might not load fast enough to catch the second click.
The pop-under technique is a clever way to make sure that the page has been loaded ahead of time.
- Get user to click something.
- Pop up the Allow page, and immediately call
self.focus()
bringing malicious site in front.
- On the first click,
popup.focus()
to bring it in front, so that the second click will hit Allow.
That is the scenario you described, but it actually doesn't work (thankfully) because of Same Origin Policy, preventing the malicious site from calling .focus()
if the popup is on a different site.
Unfortunately, the following would work
- Get user to click something.
- Pop up a 'malicious popup'.
- Get user to click something else.
- Pop up the Allow page, and immediately call
self.focus()
bringing 'malicious popup' in front.
- On the first click,
self.close()
to get rid of 'malicious popup', and then the second click will hit Allow.
Is there any way a site can protect against it?
A really easy thing is to check history.length == 1
, and if that is the case, Google knows it was opened via popup. This is not a comprehensive mitigation.
Google can use either the Visibility API, and/or self.onfocus
and self.onblur
events to require a minimum time before click will take effect. I think this can be a comprehensive protection. But it is subject to browser support.
I can imagine a more complex scenario where the Google logo is hidden by other popup(s), thereby fooling the user.
Is there anything a user ... can do to prevent this?
Just be sure not to double-click on a site you don't trust. In fact stay away from any suspicious site. ☺