Re:CSRF protection bypass due to Google analytics and weird ...
by ZoFreX on Monday May 04, 2015 @08:07PM
(#9490094)
> I've written a blog post about a bunch of types of CSRF schemes and their pros and cons, but never published it. Is this interesting enough for me to publish?
Definitely. Having looked myself, I can tell you there aren't many resources online that get this right.
Re:CSRF protection bypass due to Google analytics and weird ...
by xrstf on Monday May 04, 2015 @04:05PM
(#9488756)
It is. I want to finally understand why and how I can secure a login form against CSRF (i.e. when I don't yet have a session for the visitor).
Re:CSRF protection bypass due to Google analytics and weird ...
by Osiris on Monday May 04, 2015 @04:45PM
(#9489060)
How we do it is a little wonky. Our web app calls GET /login which returns a CSRF cookie and an anonymous session cookie and an object that says there's no active session. The app then uses that CSRF token to POST to /login. Once the auth is successful, the anonymous session is destroyed and a new CSRF secret is generated on the authenticated session.
Most advanced CSRF schemes use some crypto primitives in a manner like client-side sessions work (Enc+Mac on the server, give token to user, Validate Integrity+Dec on the server when you get it back), or HMAC some user meta-data. This allows you to distribute the key and then any server with the key can validate the token without needing to know the token in advance.
I've written a blog post about a bunch of types of CSRF schemes and their pros and cons, but never published it. Is this interesting enough for me to publish?