Jump to content

Recommended Posts

Hi,

 

I want to create a "Keep me logged in" feature for my site. The user's name and password will be stored in a cookie as an md5 hash value. So the actual username/password are NOT stored, rather the md5(username) and md5(password) will be stored.

 

Generally speaking, can you see any large security flaws with this?

Link to comment
https://forums.phpfreaks.com/topic/81734-storing-passwords-in-a-cookie/
Share on other sites

If someone copies the cookie that belongs to someone elses account, they have permanent access to that user's account without ever having to know the user's password of username. This could occur very easy for computers where more than one person may use it, but there are other circumstances where this is still a security problem.

 

My suggestion is to use a db to store users that are logged in along with a cookie that just says that that computer used an account that wants to stay logged in. Then check both the table and the cookie and you shouldn't have a problem.

If both the user name and password are md5'ed in the cookie, when the user returns how do you plan to determine which user it was?

 

And yes, storing the user's password anywhere other than in your database is a bad idea.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.