php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #19674 Session security enhancements
Submitted: 2002-09-30 08:41 UTC Modified: 2012-03-31 04:01 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: nielsene at mit dot edu Assigned:
Status: Wont fix Package: Session related
PHP Version: 4.2.2 OS: Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2002-09-30 08:41 UTC] nielsene at mit dot edu
I've noticed a few similar requests being marked as bogus, often for lack of feedback or because the orginal submitted didn't seem to really understand what they were asking.

It would be nice if the cookie used by PHP to propagate the session id between pages could conform to following format:
PHPSESSIONID="expTime+sessionid+MD5(expTime+sessionis+server_secret)"
where expTime is the unixtime stamp at which point the _server_ should stop accepting this cookie, sessionid is the current value, server_secret is some php.ini value used to generate a secure MAC.  '+' represents string concatenation with a deliminator not found in the input strings.  Client_IP should also be conisdered for inclusion in the cookie and MAC.

expTime can default to some time far in the future if people don't want to expire cookies (transient or permenant) at the server-side.

session_start would need to be revised to extract the payload, recalculate the MAC and check for cookie expiration.  For reasons of backward compatibilty it might be best to change the name of the cookie variable so that session_start can detect which format of cookie to parse so that people who don't need the added level of security aren't penalized with the increased computational load.

This feature, if client ip is included and chceked, protects users from (most) replay attacks and protects both the server and client from session hijacking.  At present one can fake this feature by setting a user-defined cookie with all the needed data and then comparing the sessionid from the session cookie with the sessionid in the user cookie.  While this method works, it requires sending two cookies to the user, which is less than ideal.

For more information about why this type of cookie is prefered, there is a long article at http://pdos.lcs.mit.edu/cookies/pubs/webauth:tr.pdf

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-01 03:16 UTC] yohgaki@php.net
It's just like my "protecting GET/POST/COOKIE vars" script at zend.com. This is worth to implement.

Anyone can implement this by your own session save handler now if you would like.
 [2010-12-01 16:15 UTC] jani@php.net
-Package: Feature/Change Request +Package: Session related
 [2012-03-31 04:01 UTC] yohgaki@php.net
There will be strict session. 
You can now use session_regenerate_id() to this with script.
 [2012-03-31 04:01 UTC] yohgaki@php.net
-Status: Analyzed +Status: Wont fix
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 22:01:30 2024 UTC