web applications - PHP: Session Security -
i read session security eg. session fixation, hijacking & injection confused workings of session security. way it:
// when user logins, $_session["user"] = "someuser"; // check user login if (isset($_session["user"]) && !empty($_session["user"]))
maybe doing wrong, don't have session ids anywhere, or @ least didn't use it. can explain how should session ids used & how affects session security? also, understanding of following threats correct?
session fixation
- user visits link (http://site.com?session_id=123) , logs in
- server "marks" session id logged in
- hacker can visit http://site.com?session_id=123
my understanding of session fixation seems wrong me. if correct won't mean hackers can randomly use session ids , used existing user?
session hijacking
- hacker somehow gets session id whether fixation or guessing etc
session injection
- what this?
you're not using session ids explicitly, php uses them automatically. session id sent cookie browser, sends server every request identify , resume session. without that, sessions not possible.
a way improve security regularly change id of session, using session_regenerate_id()
. way, if hacker acquires somebody's session id, has limited amount of time abuse it.
another way prevent session hijacking (a hacker using session id steal session) store client ip , user agent string when session opened , verifying haven't changed when resuming session.
Comments
Post a Comment