I have 3 domains : domainA domainB domainC
If I set target="_blank"
on domainA
with a link to domainC
, domainC
can access a bunch of property of domainA
. That's why I use target="_blank" rel="noopener noreferrer"
.
Otherwise, things like easier phishing are possible. Consider the following code on domainC
:
if(window.opener){
window.opener.location="http://phishing.com"
}
If domainA
contains a link like <a href="https://domainC.com" target="_blank">
, the condition will trigger and redirect domainA
to attacker controlled domain. Otheres properties, like window.opener.length
are readable.
While it is not really a vulnerability in fact because defined by the W3C, it is unknown from most developpers.
Now, I want to include an iframe from domainB
in domainA
, which I trust, but which is not protected against target="_blank"
vulnerability.
I tested and clicked on a link on my iframe, and it looks like the window.opener
wasn't null
as it would be with noopener noreferrer
, but I havn't be able to access attribute nor methods of it. When doing so (eg : redirecting), it prints :
Unsafe JavaScript attempt to initiate navigation for frame with URL
domainB
from frame with URLdomainC
. The frame attempting navigation is neither same-origin with the target, nor is it the target's parent or opener.
Then, can we consider it safe to include iframe without protection on target="_blank"
?
window.opener
properties are you concerned about?domainA
todomainC
, such asopener.location
,window.opener.location
,href
. On Firefox, doingopener.location="mywebsite.com"
result in[Exception... "<no message>" nsresult: "0x805e0006 (<unknown>)" location: "JS frame :: debugger eval code :: <TOP_LEVEL> :: line 1" data: no]
and trying to get the location withalert(opener.location)
result inerror: Permission denied to access property Symbol.toPrimitive
while it works withconsole.log(opener.location);
target="_blank" vulnerability.
? i've not heard of such a concept, so it's hard for us to give you an answer.Error: Permission denied to access property Symbol.toPrimitive
though. Can you please explain to me what that is? Edit: If you need to view the headers or something, feel free to check them at arinerron.com