-
Notifications
You must be signed in to change notification settings - Fork 37
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
[XSS, Security] Bypass found using DOMPurify tests #5
Comments
Eh, you beat me to it ;) These are the issues so far: DOM Clobbering, for now it only breaks the sanitizer code.
HTML comments should not be let through, otherwise mXSS via e.g. |
The DOM clobbering example is clobbering the createTreeWalker method which jSanity then accesses here:
So in FF, what's the fully vetted safe way to always get the real DOM method? I know we've been down this road before. =) |
@randomdross There is no reliable way. Essentially, two challenges need to be tackled here:
Our code seems to be safe against clobbering from what I can see. But it took a long time to get there :) |
Shouldn't |
It should - but is it implemented correctly in all browsers you would want to target? And what to fall back to if not? The possible solutions are plenty - yet the intersection with compatible browsers is small. Unlike server-side XSS filters, the client-side pendants have to deal with that as good as possible. One of the few yet existing disadvantages of this approach. |
It appears so, yes. YMMV though.
That one is simple for sanitizers at least. Return nothing.
Luckily we should only support ones that have a TreeWalker + createHTMLDocument / template support, and use IE10+ because, well, we all know. It looks as if the snippet above can be trusted (and I prefer that to https://github.com/cure53/DOMPurify/blob/master/src/purify.js#L366). If we get paranoid enough, we can't even trust instanceof checks. |
You know I think that beyond addressing clobbering in jSanity, this is a great opportunity to effect positive change in browsers re security. Well, trying to get a change out of legacy IE may be hopeless, but I wonder if FF would be willing to take a code change, given that:
If they don't want to change the default, maybe at least support some kind of "noclobber" mode. I hope the FF behavior isn't somehow codified in a W3C spec. I'll file a FF bug shortly. Lemme know if you're aware of any precedent where they've already dealt w/this. |
The FF createTreeWalker DOM clobbering example is now tracked as a FF bug here: |
No, for something like
would work, though.
This would presumably throw in Chrome too: |
I will move to the suggested:
...unless anyone sees a bypass. It sounds like this will only work for methods though. |
|
Ack, yes. Thank you. =) |
This is now covered by the three code changes above & additional tracking in #12 for the potential remaining issues Koto mentioned. |
Hi all,
it appears that jSanity can be bypassed using multiple techniques. We have not yet sorted out which ones - but the bypassed reproduce cleanly when using the DOMPurify test cases.
Steps to reproduce:
Strangely, we don't see any errors on the console, so we are not sure yet what causes the problem. Please let us know if this description is sufficient for you or if we should have a closer look together.
Additional Info:
The text was updated successfully, but these errors were encountered: