-
Notifications
You must be signed in to change notification settings - Fork 9
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 ...data: URI #73
Comments
Hi @magicmac! BIG FAN HERE! I Read many of your stuff over the years at https://www.brokenbrowser.com/ - I'm honored you dedicated time to breaking Snow! This vulnerability is super interesting actually, because it demonstrates an inherent problem with Snow as a solution.
This goes not only for So the problem here is more around how do we protect against cross origin realms forming inside them same origin realms to be later abused? My intuition is to enhance Snow's capabilities from just same origin realms, to also local cross origin realms. Because even though So by protecting that vector, and also integrating This will require:
This requires some thought, feedback is highly appreciated! Thanks again @magicmac! What are your thoughts on this? |
Yeah, I agree with all of what you are saying, Gal. I thought about the intermediary malicious.com website but data: looked more elegant and didn't need an external resource :)
Anyway, Gal, fantastic work! I will keep coming from time to time to play with it. =) |
|
Just tinkered with https://lavamoat.github.io/snow/demo/#self-xss-challenge-msg and figured a straight forward datauri seems to be enough. It doesn't even require an additional iframe. const content = `alert(123)`
const prefix = `data:text/html;charset=utf-8,`
const iframe = document.createElement('iframe')
iframe.src = `${prefix}<script>${content}</script>`
document.body.append(iframe) I wonder, also for blob urls, would it be possible to either rewrite the url as you mention here #73 (comment) or in the case of a blob url maybe you could just fetch the content of that blob url when the iframe enters the document and replace the blob url with a new blob url which uses the same content but adds the snow shim? |
Yes, but As for the 2nd part, blobs have made life so complicated for Snow. Luckily, we landed some powerful protections for blobs, but their so messy that I wouldn't be surprised if are not bulletproof. Furthermore, protecting blobs required some rare scenarios in Snow where the protecting patch we apply not only applies Snow protection, but also alters/blocks natural browser behaviour (not proud of it, but must be done for some edge cases). It's complicated with blobs because being a local resource, loading an HTML blob inside an iframe will execute the HTML before calling the iframe's event listener, which leaves Snow 2nd to run. This is frustrating because you can't reproduce this behaviour with iframes otherwise (except for There are so many PRs and issues about blobs in Snow that I can't really share all of them without making your head spin. |
Yeah, you would presumably want to patch the Though as you mention you said it's out of scope. |
Patching We will try to inject ourselves into |
This issue has (hopefully) come to an end thanks to #122 🎉 This is a very tricky exploit that Snow might not have much it can do about. Therefore it was decided that it would be best if Snow integration will include calling Snow in every HTML file served by the same origin. Intuitively you might think "if so, no need for Snow then" - Well, you'd be surprised, there are many other types of same origin attacks regardless of this. Thank you for this wonderful discovery @magicmac ❤️ |
Hey Gal! Nice to "meet you". I was reading your DevTools detection mechanism yesterday and I ended up landing into this LavaMoat. The challenge looked interesting (you know, when it bites you, you can't stop!) so I give it a few tries, and luckily, it worked!
Here's the code. I believe the best strategy to patch this would be to check whenever a non-accessible domain has iFrames inside, and if that's the case you can continue iterating and testing until you make sure none has access.
Have a great day!
The text was updated successfully, but these errors were encountered: