LWN.net Logo

Wordpress Cookie Authentication Vulnerability

Wordpress Cookie Authentication Vulnerability

Posted Nov 20, 2007 9:45 UTC (Tue) by Velmont (subscriber, #46433)
Parent article: Wordpress Cookie Authentication Vulnerability

Hmm. In my own CMS (before I went over to use WordPress), I salted the extra md5 in the cookie, like this:

cookie_pass = md5( md5(password) + config['salt'] + userid )

Wouldn't that be safer if every user must define config['salt'] in their config file?


(Log in to post comments)

Wordpress Cookie Authentication Vulnerability

Posted Nov 20, 2007 11:41 UTC (Tue) by Los__D (subscriber, #15263) [Link]

AFAIK, normally you generate a random salt, and store that salt with the password.

Salts are only there to avoid dictionary attacks.

Wordpress Cookie Authentication Vulnerability

Posted Nov 20, 2007 11:41 UTC (Tue) by Los__D (subscriber, #15263) [Link]

Ehm, that would be the password hash

Wordpress Cookie Authentication Vulnerability

Posted Nov 20, 2007 13:40 UTC (Tue) by drag (subscriber, #31333) [Link]

Because anybody can use the md5sum of the md5sum of the password to gain access to any account
there isn't any point to cracking the password. Effectively Wordpress found a way to defete
the whole point of using hashes to secure passwords. They could of used all the salt in the
world and it wouldn't of mattered.

Maybe using 'md5sum[ salt + md5sum[ password ]]' to make the token would of made a difference.
But then it would matter exactly how the cookie-based auth token is generated. For instance if
the salt was stored in the same database as the password hashes it wouldn't do much good.. if
the salt was time based it wouldn't do much good. 


This sort of thing is a very difficult problem and is why most of the time it's better to use
some method that has been developed by security researchers and has been audited by third
parties rather then try to make up your own auth systems.

Wordpress Cookie Authentication Vulnerability

Posted Nov 20, 2007 14:49 UTC (Tue) by Los__D (subscriber, #15263) [Link]

This was in response to making the salt a configured value.

Of course, when nobody really needs to care about testing the sums, they could have stored the
passwords bit flipped, and have Wordpress no more unsafe than it is now...

Wordpress Cookie Authentication Vulnerability

Posted Nov 20, 2007 16:28 UTC (Tue) by zlynx (subscriber, #2285) [Link]

What they need to do is either use SSL client certificates, which would be a great idea since
they do exactly what is desired: authenticate the client, or:

Use Javascript.  Have the server provide a random value, then in Javascript MD5 or otherwise
hash the password or password MD5 + random value and return the result to the server.

In either case, the secret is never sent over the network.

Wordpress Cookie Authentication Vulnerability

Posted Nov 20, 2007 18:03 UTC (Tue) by Max.Hyre (subscriber, #1054) [Link]

Wouldn't that be safer if every user must define config['salt'] in their config file?
No. Anything the user adds to the authentication process weakens it: witness passwords. If you want to use salt, generate it yourself; otherwise you'd get config['mh'] all over the place. (Where ``mh'' is the user's initials.)

Copyright © 2008, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds
Powered by Rackspace Managed Hosting.