Just how safe is a session based on a mysql field id for user indetifcation?

Reply

Join Date: Dec 2007
Posts: 136
Reputation: justted is an unknown quantity at this point 
Solved Threads: 2
justted justted is offline Offline
Junior Poster

Just how safe is a session based on a mysql field id for user indetifcation?

 
0
  #1
Jun 18th, 2009
Hello all,

Just wanted to see if I am leaving open some security hole in a script I have! When the user logs in it creates a session based on the id field of the users table! For example .... my id is 10 so a session is created with based on that.

What I wanted to know is if I want a secure way to identify a genuine user based on their session then should I make this session more complicated by adding further details? Or even create multiple sessions?

I am currently checking the user against my sql table id against their session but thought that if someone created a session from another website with for example the number 10 then I wouldnt want them being able to access my members account whose ID number is 10!

Hope this makes sense and someone can clarify the best way around it

Thanks
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 152
Reputation: kireol is an unknown quantity at this point 
Solved Threads: 19
kireol kireol is offline Offline
Junior Poster

Re: Just how safe is a session based on a mysql field id for user indetifcation?

 
0
  #2
Jun 18th, 2009
Session is fairly safe but hackable.

Here's a decent rundown that may help you: http://www.sitepoint.com/blogs/2004/...sion-security/
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 1,227
Reputation: kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about 
Solved Threads: 167
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Nearly a Posting Virtuoso

Re: Just how safe is a session based on a mysql field id for user indetifcation?

 
0
  #3
Jun 18th, 2009
Its pretty secure. Adding more info and creating extra session is unnecessary overhead.

The best way to prevent this is to run session_regenerate_id(true).

[kireol explains everything nicely, I posted at the same time. Didn't see that post]
Last edited by kkeith29; Jun 18th, 2009 at 10:07 pm.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC