Forum Moderators: coopster

Message Too Old, No Replies

How secure are PHP sessions?

(especially on a shared server)

         

zulu_dude

6:48 pm on Aug 3, 2005 (gmt 0)

10+ Year Member Top Contributors Of The Month



Forgive me if this has been asked before, but I have searched this forum and can't find any detailed reference to the problem.

I'm making a site that requires users to login. The data that regular users can access isn't especially sensitive. Requiring them to login is more for marketing purposes than for security. So basically, it won't be a disaster if their session ID's are sniffed and someone logs in as them.

However, there are some users that will be able to upload/edit items on the site. They will also have to login, although with a seperate php script and differently named session variables. Their info is also stored in a different MySQL table.

The site will be hosted on a shared server, which probably increases vulnerability to attack, even if I do my best to limit the access that other hosting accounts have to my files.

My question is, how paranoid should I be? If power-users only login to add things, for example, once a week (as opposed to every day for regular users) what are the chances of a hacker sniffing out their session ID and using it to attack the site? More specifically, has this ever happened to anyone on this forum?

I don't want to spend a million unnecessary hours encoding all the session ID's and assigning random keys on each request to the server, unless I absolutely have to!

Thanks in advance for your advice!

jatar_k

8:46 pm on Aug 3, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



you might want to take a look at
PHP User Authentication and Passwords [webmasterworld.com]
PHP Peer Code Review [webmasterworld.com]
PHP Security [webmasterworld.com]

do sessions get hijacked, definitely
shared server env makes things interesting, there is always the possibility of other people on the same host accessing your files, though that really depends on the host

making sessions expire after a short period of time helps to protect them.

zulu_dude

8:22 am on Aug 4, 2005 (gmt 0)

10+ Year Member Top Contributors Of The Month



Awesome, thanks jatar_k.

Obviously I didn't look properly, as this is just the info that I needed! Thanks!