4 ms·
Yeah, this article doesn't make sense to me. As I understand double-submit CSRF protection, it works like this: The CSRF token is included in an HTTPOnly cook
by jasoncrawford 13y ago
Yeah, this article doesn't make sense to me.
As I understand double-submit CSRF protection, it works like this:
The CSRF token is included in an HTTPOnly cookie, and it's also included in the page content itself. That can be in an HTML form that gets posted, or in an in-page script tag that sets the cookie on a global JavaScript object, or whatever.
Then the client sends the second, accessible version of cookie in a request parameter or HTTP header, and also (automatically) sends it as one of the cookies. The server just has to check that the token in the param or header matches the token in the cookie. The server doesn't have to remember the token value, so there's no required server-side state here.
I am far from a security expert, though.
- jeffasinger 13y agoI believe that it's not an HTTPOnly Cookie (which is a problem because of XSS), and that it gets set in JS just before the request. The idea is that due to the Same Origin Policy, other sites will not be able to set the Cookie for your domain.
- preinheimer 13y agoBut I can throw in an iframe or something to get your browser to make a request against that domain (and get a cookie)
- nbpoole 13y agoYou can't just read cookies for arbitrary domains in an iframe.