-
Notifications
You must be signed in to change notification settings - Fork 48.6k
Consider What Happens to XSS Surface Area With No Whitelist #10507
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
Comments
I think checking for attributes that start with There's a related conversation to have about custom/future event support. Depending on the timeline, that might not be possible for 16.0.0. Would adding custom event support require a major release? I'm going to investigate if the Event prototype gives us anything about if the handler is a string. I'm guessing no, but it looks like |
Checking the spec... https://www.w3.org/TR/html51/webappapis.html#event-handlers-on-elements-document-objects-and-window-objects I haven't found anything yet that, more or less, says "all events start with |
Even if all events start with <script {...data}></script> What else can be used? |
We still do not provide any protection against There will always be edge-cases that are hugely problematic, spreading onto a/form/style/script/object/embed (object/embed could probably be huge). If values can be objects then anywhere you spread is problematic (style is vulnerable). Neither to forget that spreading user-supplied values onto a component can theoretically do anything. If there are third-party scripts on the site you could also imagine quite complex attacks that React simply cannot defend against. I wonder if it wouldn't be preferable to not address this in a sense. If you're spreading props in this manner it's obviously exploitable, but it's more likely that someone will just lololtroll you just for fun quickly rather than someone intentionally malicious finding a complex edge-case in the future that would be catastrophic. If you're spreading user-supplied props you're in for a bad time, so IMHO it makes sense that if you do add a blacklist, that it would straight up throw a strongly worded error that hopefully shows up in their error tracking. |
We addressed this specifically for the |
Uh oh!
There was an error while loading. Please reload this page.
Consider the case in #10506 but let's say we've fix it by special casing
dangerouslySetInnerHTML
to use a symbol.Now consider this URL:
If
onclick
(or any other event name, current or future) gets passed through as a plain old string, then this is a XSS vulnerability.The tricky part about this one is that it's plain old strings and it's a potentially infinite long list since it also includes future event names.
Now I think a safe strategy might be to hard blacklist (meaning they don't get added to the DOM) any attribute that starts with
on
. Does that cover everything?cc @nhunzaker
The text was updated successfully, but these errors were encountered: