Re: [PHP4BETA] CVS update: php4/ext/session

From: Date: Tue, 08 Jun 1999 04:47:31 +0000
Subject: Re: [PHP4BETA] CVS update: php4/ext/session
References: 1 2 3 4  Groups: php.version4 
Request: Send a blank email to php-version4+get-1386@lists.php.net to get a copy of this message
On Mon, Jun 07, 1999 at 06:06:27PM -0400, Jim Winstead wrote: > On Jun 07, Sascha Schumann wrote: > > Well, a hash algorithm with no collisions does not exist to the > > best of my knowledge. Hence, we can only hope that we don't > > produce any collisions. > > > > As Kristian said before, the algorithm must not be > > deterministic. Using some kind of randomness to make the ids > > unguessable is what I think I'll go for. > > > > I'll do some work on the user-level hooks as well today. > > Unless you are drawing your randomness from something like /dev/random, > it is deterministic, because all you're doing then is using the > "srand($deterministic_seed); rand();" steps as a glorified hash > function. > > The session id should be composed of both deterministic and random > components -- the deterministic part makes it so you can guarantee > there's no collisions, and the random part to make it harder for > people to hijack sessions. It's not that easy. Here is the proposal I'll use unless someone can point out some kind of weakness in it: We need a session id which is unguessable, if the attacker knows all normal data which is sent from the client (such as IP, user agent) to the server, but does not know which data is actually sent (else he could simply wait for the session id to be passed - HTTPS is the only solution in that case). Now, we use some deterministic data (the current time) which could be guessed. Additionally, we use a linear CG which is not as complex as the Mersenne Twister (which is quite new and hardly researched, AFAIK), but still has a periode of ~10^18. This is initialized on module startup and fed with various user data during its whole life time (/dev/random is also deterministic, we would need some kind of external device which provides real random data such as a microphone or a light diode). So, for a attacker to reproduce our session ids he would need - the knowledge which server module/thread will generate the session id - all client data (limited to static values) which have accessed the module/thread before - the time in microseconds when they have accessed the server This is not 100%, but it should make it pretty hard to simply guess the next session id, especially in a multiprocess or multithread environment. There is an attack scenario possible on light loaded web servers, but if one is really concerned about security, he uses HTTPS anyway. -- Regards, Sascha Schumann Consultant

« previous php.version4 (#1386) next »