Full Disclosure mailing list archives

Re: defense against session hijacking


From: "Jason Ziemba" <jason () ziemba net>
Date: Tue, 18 Nov 2003 08:18:55 -0500 (EST)

I'm not going to claim that my method is fool-proof, but..
If you are using sessions on your site then you should have the ability to
track the movement of a user through-out your system.

If you record the last page the user was on (with a specific session-id)
and then check the referrer server variable on their next hit.  Compare
the referrer to their last known page.  Most of the time (depending on the
complexity of your site) the referrer and last known page should match. 
If their session is 'hijacked', odds are the 'hijacker' will not be
following in a valid user's footsteps, more likely they will just be
coming at the server with rogue data.  The referrer check won't match and
thus the validity of the session request is also void.

The catch is, how much programming are you willing to do to ensure the
integrity of your system.  If you are looking for the easy-route (using
PHP's embedded session module) then there is no direct way to secure the
sessions.  If you are willing to build you own session module for your
given CGI language then the sky is the limit (as long as you are willing
to get your hands dirty at the start).


Jason Ziemba

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi All,

Sorry if this is common knowledge or regularly discussed; I'm fairly
new to the list.  I see quite a few messages on this and other
security lists about session hijacking in Web applications.  Isn't it
good defense for a programmer to store the IP address of the client
when the session is initiated, and then compare that address against
the client for each subsequent request, destroying the session if the
address changes?  Do many programmers really overlook this simple
method to protect against such an attack?  It's not perfect but should
significantly increase the difficulty of such an attack with little or
no annoying side effects for the legitimate user.  Would it be useful
to extend the session modules of the common Web scripting languages
(e.g. PHP) to enable an IP address check by default?

Best Regards,

- --
:: t  h  o  m  a  s       d  u  f  f  e  y
:: h o m e b o y z   i n t e r a c t i v e
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQE/uTrH8fKWAp8CzDARAhyOAJ9kXkkiUERgEVRWhH5GtGACTKA1hwCfak+7
KsyUSQG+iAcPVxX3BIdTTRc=
=9f2R
-----END PGP SIGNATURE-----


_______________________________________________
Full-Disclosure - We believe in it.
Charter: http://lists.netsys.com/full-disclosure-charter.html


_______________________________________________
Full-Disclosure - We believe in it.
Charter: http://lists.netsys.com/full-disclosure-charter.html


Current thread: