Invalid remember-me token (Series/token) mismatch. Implies previous cookie theft attack

人走茶凉 提交于 2019-12-05 13:27:55

While waiting for somebody to post an answer to this question, I thought of a better solution to this issue. By default, the PersistentTokenBasedRememberMeServices.processAutoLoginCookie() updates the token for every request. My solution to this is to override the behaviour of processAutoLoginCookie() and removed the updating of the cookie part. This solves the cookietheft exception but this will open a security hole to the attacker since the cookie doesn't updates for every request. If the attacker able to steal the cookie, he can use that cookie to access the protected site. To prevent that to happen, I'm thinking of adding an IP address as part of to the cookie and validate every request if the cookie comes from the owner of the session. I haven't implemented the IP validation but for me this is the better way to solve this problem.

I hope this also helps to some of you having the same issue I have.

modify your web.xml, in error-page sections, add location (e.g. /signin) for org.springframework.security.web.authentication.rememberme.CookieTheftException

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!