Secure Cookies and Passwords

December 17, 2007
by Ryan

WordPress 2.4 will feature a new format for authentication cookies and a new password hashing algorithm. Cookies will be based on the secure cookie protocol described here. The cookie is structured like so:

user name|expiration time|HMAC( user name|expiration time, k)
where k = HMAC(user name|expiration time, sk)
and where sk is a secret key

The new cookie protocol will allow us to enforce expirations server-side, mass invalidate all cookies, and offer high-level confidentiality. Read the Liu paper for details on the protocol, and see ticket 5367 for details on our implementation of the protocol.

In conjunction with the new cookies, password hashing will be improved by moving to phpass. phpass provides password stretching and salting. These make brute-forcing your password hashes impractical should someone get access to your database. phpass is being considered for inclusion by Drupal and phpBB, which bodes well for integrators who want to auth all of these apps off of one user table. However, I’m not sure how well things like mod_auth_mysql play with the portable hashes generated by phpass. Anyone with experience there? While moving the code to phpass, we made password hashing completely pluggable should integrators need to switch to a different hash. Hopefully everything can place nice with phpass.

The new cookies and hashes are still under development but are available for testing by grabbing svn trunk. Don’t test on a production blog since reverting back to your previous version requires restoring your users table from backup to get your old password hashes back.

17 Responses
  1. December 17, 2007

    This sounds very interesting, I would love to see it’s effects in action…It will definitely increase wordpress’ security.

  2. December 18, 2007

    Very cool, definitely waiting for that update. I like the control over cookies, very convenient!

Trackbacks & Pingbacks

  1. Liquidmatrix Security Digest » Security Briefing: December 18th
  2. Wordpress 2.4 to use Secure Cookies and Passwords : bloginfosec.com
  3. 20f1aeb7819d7858684c898d1e98c1bb at Holy Shmoly!
  4. WordPress weekly digest 10th December to 16th December 2007 « westi on wordpress
  5. » WordPress weekly digest 10 dic - 16 dic 2007 » WordPress Italy
  6. links for 2007-12-21
  7. Richy’s Random Ramblings / Coding: Password Security in Cookies
  8. » Cookie sicuri e password » WordPress Italy
  9. Purposemakers - Website Design & Development, Strabane, Co. Tyrone, Northern Ireland.
  10. Wordpress 2.3.2 released and Wordpress Version 2.5 (aka Wordpress 2.4) - Planned features | Bullroarer
  11. ליאור שיאון - קיים משמע אני חושב. » Blog Archive » עידכון אבטחה בוורדפרס 2.4
  12. Episode 33: WordPress 2.3.2 released, WordPress 2.4 missed and changes to the podcast | PHP Podcasts
  13. » MD5 Password Hashes for 2.5 boren.nu
  14. WordPress 2.5’s New Password Hashing Scheme | WordPress Philippines
  15. 5-Finger-Blog von Hollii » WordPress Secret_Key

Comments are closed for this entry.