tags:

views:

86

answers:

2

Is their any way to hide sessions ID's from being sniffed?

+7  A: 

Don't append the SID to the URL.
Use https.
(Set the httponly flag for the session cookie.)

VolkerK
httonly = httponly cookie but I guess everybody understood that.
Alfred
+1, I wasn't aware of the httponly flag
Paul Dixon
I guess it depends on how you define "sniff", but Jeff blogged about the httponly flag a while ago, http://www.codinghorror.com/blog/archives/001167.html . Since I see no reason whatsoever for a client-side script to access the session cookie I set session.cookie_httponly in the php.ini to On
VolkerK
+1  A: 

If by "sniffed", you mean "sniffed by a man-in-the-middle attacker listening in on all the network traffic between server and client", the only sure way is to use https.

Whether you append the SID to the URL makes no difference: The SID is still sent as a cookie, and if you're not on HTTPS, that cookie is sent unencrypted.

httponly flag protects very nicely against XSS attacks - see the blog post VolkerK linked to - but not against sniffers

( ... if that is a verb)

You probably have to clearly define which kind of attacker you are trying to protect against to get more answers.

James
VolkerK
Yeah, that's why I was careful to define what "sniffed" usually means in a technical context first and point out the loose definition ... no offense meant. not appending the SID to the URL would help with general security, with problems of your SID appearing in the referrer field of someone else's logs, and also these days, for SEO purposes.
James