开发者

A login token system

开发者 https://www.devze.com 2023-01-05 03:12 出处:网络
I am currently creating a very basic piece of D开发者_JS百科BMS software - I would however like the user not to have to type in their details every time. Instead I would like them to click on a contro

I am currently creating a very basic piece of D开发者_JS百科BMS software - I would however like the user not to have to type in their details every time. Instead I would like them to click on a control pannel link that would log them straight in.

My solution thus far has been a token system whereby there is a table in the database with the login details for that user accompanied by a tokenString - the user simply goes to a page passing the tokenString as a post variable and it logs them in.

Is this a good idea?

Many Thanks, J Harley


It's not completely secure, but you are making an ease of use tradeoff. So if the page you display the links on changes the tokens for each person's login every time it is loaded (and makes the tokens expire after some short time period), you'd prevent the link from getting out into the wild or someone hacking their email and getting an old login link.


I realize this is over 9 years old, but have you heard of "Hardened Stateless Session Cookies"?

The Fu et al. scheme [of stateless session cookies] has the property that an attacker who can read the cryptographic key stored in the database can create spoofed cookies. [...] It’s good practice in security engineering to design systems with the widest possible range of attacker capabilities in mind. I therefore designed a cookie scheme which would do all that the Fu et al. design did, but also maintained some of its security properties if the attacker has read-access to the authentication database and knows the cookie authentication key. I published a paper on this topic — Hardened stateless session cookies — at the 2008 Security Protocols Workshop.

The trick behind my scheme is to store the hash of the user’s password in the cookie, and the hash of that in the authentication database. This means that it’s possible for the server to verify cookies, but the authentication database doesn’t contain enough information to create a fake cookie. Thus an attacker with read-access to the database still needs to know the user’s password to log in, and that isn’t stored. There are some additional subtleties to resist different attacks, and those are described in the paper.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号