php - How Do I Make Sessions More Secure? -
possible duplicate:
php session security
i using sessions throughout application. want make them more secure. using code $username = $_session['username'];
, like.
how make sessions more secure?
the first thing you'll want watch out session hijacking. quote wikipedia:
in computer science, session hijacking refers exploitation of valid computer session—sometimes called session key—to gain unauthorized access information or services in computer system. in particular, used refer theft of magic cookie used authenticate user remote server. has particular relevance web developers, http cookies used maintain session on many web sites can stolen attacker using intermediary computer or access saved cookies on victim's computer (see http cookie theft).
the basic idea is, if visitor website (alice) has session cookie , session id (let's assume it's 12345
), if malicious user (mallory) able learn alice's session id via either javascript, traffic sniffing, social engineering or other methods, mallory can browse site , set session id 12345
, becomes alice.
one way prevent alter session id on every request, can via php session_regenerate_id
function. call session_regenerate_id
@ beginning of every request, after calling session_start()
please aware complicated topic. i'd highly recommended reading wikipedia article , making sure understand issues @ play.
edit: type lot more information out you, realized question duplicate of stackoverflow question. i'd recommended reading starting point.
Comments
Post a Comment