Chicken and egg issue with Cookie based login?

Chicken and egg issue with Cookie based login?

Secure Home | Search | About
 General Computer Security    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content add this group's latest topics to your Google content
Subject Author Date
Chicken and egg issue with Cookie based login? Julio 04-06-2005
Posted by Julio on April 6, 2005, 4:39 am
If you were  Registered and logged in, you could reply and use other advanced thread options
I have few questions I hope someone can clear up for me with the cookie
security discussion at this W3C document:

http://www.w3.org/Security/Faq/wwwsf2.html#CLT-Q10

I'm trying to implement a cookie based authentication system for our
private web server. The document suggested a popular algorithm/method to
generate a MAC.

MAC = MD5("secret key " +
MD5("session ID" + "issue date" +
"expiration time" + "IP address" +
"secret key")
)

It also says this about the secret key:

"This algorithm first performs a string concatenation of all the data
fields in the cookie, then adds to it a secret string known only to the
Web server."

My questions are:

How is this a "secret" only know to the server if its needs to be passed to
the client in order to generate the hashed cookie? Sounds like a chicken
and egg scenario, since you need to contact the server to get the secret key
in the first place?

Second, would be an example of the "Session ID" or more general, what is an
example for a secret key and session id for a system that users a
username/password database on the server side?

if my web server has a built-in user database storing a user name and
password, and the typical login form for a web page would be for a
userid/name and password prompt, it seems to me that this "Session ID"
could be the combo of the userid/password? or....

Since this is a hash, there needs to be some unhashed value passed to the
server, like the user name and only include the password (Session ID?) in
the hash in order to do the username lookup and perform a hash comparison
with the password?

Is the "Secret Key" the user's password and the Session ID the user's name?

Finally, what I came up with (to explore) is this:

MAC = MD5(password +
MD5(userid + sessionkey + password) )

where sessionkey is unique hash key for the new login session. It contains
the following:

sessionkey = MD5(IP + unique counter + timeout window)

All 3 parameters are cached at the server mapped to the sessionkey.

Next the cookie is set:

COOKIE = username + ":"+ sessionkey+":"+MAC

At the server, the username is looked up to get the user's database
password, and the sessionkey is looked up to get the 3 session parameters.
The appropriate checks are then performed; the IP is compared; the timeout
window is checked, and the MAC is regenerated based all the server ready
variables.

I know its not 100% fool proof, but does this make sense?

Currently our web server supports BASIC and DIGEST (and SSL), so of course,
if anyone is concern with security, they are steered to enforcing SSL or
atleast DIGEST for non-SSL operations. The cookie support has been a big
request mainly to offer the complete log off capability lacking in standard
BASIC/DIGEST methods.

So I want something with cookies that is atleast better than plain text
BASIC using a similar "session key" challenge concept as done with DIGEST.

Make sense?

Thanks



Posted by Barry Margolin on April 6, 2005, 8:52 am
If you were  Registered and logged in, you could reply and use other advanced thread options

> I have few questions I hope someone can clear up for me with the cookie
> security discussion at this W3C document:
>
> http://www.w3.org/Security/Faq/wwwsf2.html#CLT-Q10
>
> I'm trying to implement a cookie based authentication system for our
> private web server. The document suggested a popular algorithm/method to
> generate a MAC.
>
> MAC = MD5("secret key " +
> MD5("session ID" + "issue date" +
> "expiration time" + "IP address" +
> "secret key")
> )
>
> It also says this about the secret key:
>
> "This algorithm first performs a string concatenation of all the data
> fields in the cookie, then adds to it a secret string known only to the
> Web server."
>
> My questions are:
>
> How is this a "secret" only know to the server if its needs to be passed to
> the client in order to generate the hashed cookie? Sounds like a chicken
> and egg scenario, since you need to contact the server to get the secret key
> in the first place?

Cookies are created by the server, not by the client. Clients just
receive the cookie, save it away, and return it to the server with all
future requests. The server generates the hashed cookie and sends it to
the client.

>
> Second, would be an example of the "Session ID" or more general, what is an
> example for a secret key and session id for a system that users a
> username/password database on the server side?
>
> if my web server has a built-in user database storing a user name and
> password, and the typical login form for a web page would be for a
> userid/name and password prompt, it seems to me that this "Session ID"
> could be the combo of the userid/password? or....

What if you want to allow the same user to login concurrently from
different clients (e.g. a husband and wife both checking their bank
account balances)? You need to use something unique to a particular
login, not just identifying the customer. You can just use a counter,
incrementing it every time a login comes in.

>
> Since this is a hash, there needs to be some unhashed value passed to the
> server, like the user name and only include the password (Session ID?) in
> the hash in order to do the username lookup and perform a hash comparison
> with the password?
>
> Is the "Secret Key" the user's password and the Session ID the user's name?

The secret key should be a random value generated at login time; if it
were the user's password, it wouldn't be known only to the server, it
would also be known by the client.

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


Posted by on April 8, 2005, 6:23 pm
If you were  Registered and logged in, you could reply and use other advanced thread options
dont think u should make cookies with ip, cause some users with dynamic
ip have their ip changed all the time





Cowly the Game player
Games I support

http://www.gamestotal.com
http://www.spacefederation.net
http://uc.gamestotal.com
http://aw.gamestotal.com
http://gc.gamestotal.com
http://mmorpg.gamestotal.com
http://3700ad.gamestotal.com
http://ballmonster.gamestotal.com
http://free_mmorpg.gamestotal.com
http://strategy_games.gamestotal.com
http://free_strategy_games.gamestotal.com



Similar ThreadsPosted
Advice, security specification calls for using system login to do login to web application August 28, 2007, 8:19 am
SquiggleSR : deceiving search engines and cookie tracking May 5, 2008, 12:12 pm
DNS based ACLs failing July 1, 2004, 10:17 am
IDS based on neuronal networks April 19, 2005, 9:46 pm
Single Signon cookie encryption - industry standard/best practice? August 24, 2004, 9:34 pm
Looking for an authentication software based on RADIUS January 10, 2006, 10:21 am
Skype Based Remote Desktop & Netmeeting January 6, 2006, 2:55 am
remote access solution with mobile phone / SMS-based authentication? December 19, 2005, 4:43 am
Auto Proxy Login?? Please help March 14, 2005, 4:39 am
how to log or block login attempts on OS X? August 18, 2006, 5:04 pm

The site map in XML format XML site map

Contact Us | Privacy Policy