Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snow can be bypassed with postMessage from iframe by accessing event.source and event.currentTarget #68

Closed
rwaldron opened this issue Jan 24, 2023 · 3 comments
Labels
wontfix This will not be worked on

Comments

@rwaldron
Copy link

Reproduce by running

const handler = (event) => {
  event.currentTarget.alert(1)
  event.source.alert(1);
  window.removeEventListener('message', handler);
};

window.addEventListener('message', handler);

const iframe = document.createElement('iframe');

document.body.append(iframe);

const script = iframe.contentDocument.createElement('script');
script.textContent = `
  window.parent.postMessage(0, '*');
`;

iframe.contentDocument.body.append(script);

In https://lavamoat.github.io/snow/demo/

@weizman
Copy link
Member

weizman commented Jan 24, 2023

Can't seem to reproduce this successfully. Here are the steps I've taken:

  1. visit https://lavamoat.github.io/snow/demo/
  2. open console
  3. paste payload above
  4. press enter

Result: Snow successfully captures the alert attempt and logs it to console instead.
Would you mind helping me understand what I'm missing? A video or any other creative idea will be highly appreciated.

@rwaldron
Copy link
Author

I just realized that I hadn't refreshed the demo page, so my previous changes were still active in the global object. lol, realms are hard 🤦

@weizman
Copy link
Member

weizman commented Jan 24, 2023

lol, yea tell me about it. I feel like I'm closer to madness than adoption with this project tbh.

@weizman weizman added the wontfix This will not be worked on label Jun 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants