LiveWire Network Peer Answers Peer Support Teen Forums Tech Forums College Forums 308 users online 225443 members 319 active today Advertise Here Sign In
TeenCollegeTechPhotos | Quizzes | LiveSecret | Memberlist | Dictionary | News | FAQ
Member Spotlight
Ziggy Stardust
Music: Arctic Monkeys, Muse, Death Cab For Cut...
Mood: Tearful
You have 1 new message.
Emergency Help
Until you sign up you can't do much. Yes, it's free.

Sign Up Now
Membername:
Password:
Already have an account?
Invite Friends
Active Members
Groups
Contests
Moderators
3 online / 15 MPM
Fresh Topics
  LiveWire / Technical Forums / Programming & Application Development / Adding Reply

Adding Reply
Archived Topic: It will not be bumped to the top of the forum.
Topic Implementing session cookies
Membername   Not a member? Sign Up Free (takes 20 seconds)
Password   Forgotten your password?
Post

Font:   Size:   Color:

FAQ Keyword Search:
Post Options
Favorites Manager
Notify me of new replies to this topic by email
Notify me of new replies to this topic by private message
Original Post
Mediocre Posted at 8:22 pm on Aug. 15, 2008
So, I just finished coding the login script for an upcoming project. It relies on a session cookie with a value that is (essentially) the user's password, hashed. I'm worried that someone could steal the value of this cookie and then create "poisoned" cookies with that value whenever they want to impersonate their victim. One way to mitigate this would be to salt the password hash with something (like the day's date) that would make the cookie only work for a limited time.

How do other coders take care of this? Or is it considered acceptable to use a cookie that could last forever?

Salting with the user's IP will not work, because most of my visitors connect via Tor...

Replies
telomere13 Posted at 9:17 pm on Aug. 15, 2008
I have no idea what language you're using so that means absolutely nothing to me.  

That said, is the date reversible in any way?  As long as the date is reversible and the rest is constant, all you need to do to make a fake cookie is use the current date with the constant part.

Mediocre Posted at 9:13 pm on Aug. 15, 2008
Well, I decided to name the cookie (something to the effect of)
Code:
"orly_".sha1(CzQTqaxd29TP1zag9AlENL0sMPsaNGiNju2nhoRZ.date('zYF'))
I don't see how this could realistically be reversed.
telomere13 Posted at 8:31 pm on Aug. 15, 2008
You can put the date in, but you need to make sure that it's secure, because if the person can extract the date from the cookie, they can make their own with any date. So I would say, at very least, use a pseudorandom generator seeded with the date, but if you want any reasonable degree of security, look at the code for an open source messageboard software (like PHPBB).

(edit)Keeping the password's key, forever, is really no better than storin the password in plain text.

Mikebean Posted at 8:24 pm on Aug. 15, 2008
Post from this position was omitted due to content violations
doritoz723 Posted at 8:23 pm on Aug. 15, 2008
Post from this position was omitted due to content violations
Fortis Obscurum Posted at 8:23 pm on Aug. 15, 2008
Post from this position was omitted due to content violations
All 6 previous replies displayed.