News for hackers. Stuff that matters.
Re:Hacker News CSRF Vulnerability by kogir on Thursday February 25, 2016 @07:09PM (#11178922)
That's actually not always enough. For example, to fix this login CSRF on HN, you need a per-visitor secret an attacker can't read (like a cookie) plus a form value based on that secret. Note it can't be tied to the user account, because the visitor hasn't logged in yet.

A random CSRF token on a login form is easily defeated - the attacker just requests a valid one and uses it when submitting the CSRF form.

Re:Hacker News CSRF Vulnerability by etjossem on Thursday February 25, 2016 @08:26PM (#11179253)
Correct. By "a valid token" I mean one that corresponds to the user session it was dispensed to.
Re:Hacker News CSRF Vulnerability by jonny_eh on Thursday February 25, 2016 @07:30PM (#11179028)
> the attacker just requests a valid one

How?

Re:Hacker News CSRF Vulnerability by kogir on Thursday February 25, 2016 @07:42PM (#11179082)
wget, curl, whatever. If I'm the attacker, I ask for a new one from my server each time and put the result in the form I serve your browser.
Re:Hacker News CSRF Vulnerability by r1ch on Thursday February 25, 2016 @08:11PM (#11179209)
The CSRF token should be tied to the user session, so you'd need to perform session fixation for that to work.
Re:Hacker News CSRF Vulnerability by ubernostrum on Thursday February 25, 2016 @09:10PM (#11179407)
Tying to the session is a common practice but not necessary. You can do non-session-tied CSRF tokens so long as you don't expose your cookie.
Re:Hacker News CSRF Vulnerability by kogir on Thursday February 25, 2016 @08:52PM (#11179353)
That works if you have sessions. HN doesn't.