4 ms·
How can they do that via CSRF? The attacker would need access to javascript on the victim page to have the token pulled from localStorage, append the token to t
by dmix 12y ago
How can they do that via CSRF? The attacker would need access to javascript on the victim page to have the token pulled from localStorage, append the token to the request in order to successfully submit a form. This is protected via SOP. GET requests do not return the localStorage data... nor do GET request modify any data, unless poorly programmed. Form POST requests that get submitted by an attacker are missing the token in the request, where with cookies it gets appended automatically.
Token auth is vulnerable to XSS attacks, but not CSRF. So additional precautions can be added.
But I do tend to agree with Egor Homakov where XSS is a serious risk to use auth token stored via httpOnly cookie: https://twitter.com/homakov/status/298744658706714624 https://twitter.com/homakov/status/298744658706714624