user260019
user260019

Reputation: 553

Is cookie PHPSESSID the only key to for a $_SESSION in PHP?

If it's true,and I know the value of PHPSESSID,can I fake that user?

Upvotes: 2

Views: 2529

Answers (1)

Gordon
Gordon

Reputation: 317197

Kind of. If you know the Session ID you can hijack her session.

You could also transparently pass the Session ID via the URL by enabling --enable-trans-sid in your PHP Ini, which makes accidental session hijacking more common, e.g. when people send links around that contain the SID. So you're better off with Cookies as they are much harder to steal.

However, you can rename PHPSESSID to a different key to make attempts at guessing the key somewhat harder or use custom session handlers that do additional checking on the request, e.g. check the IP or against another cookie.

See

Upvotes: 3

Related Questions