Get fresh WordPress Content delivered in your inbox with warpspeed!

learn wordpress wplift wordpress rocket

Like many web applications, Wordpress stores user accounts in a MySQL database, including administrative user accounts with their associated password hashes. A closer inspection of the method chosen for hashing passwords in Wordpress offers an critical view of how secure or insecure the hashing methods in place are for such high profile and widely used software.

Way back as of Wordpress 2.5 (March 2008), phpass has been used to hash passwords for storage in a MySQL database. phpass was written by Alexander Peslyak (aka Solar Designer), founder of the Openwall Project and creator of John the Ripper who is perhaps one of if not the authority on various hashing algorithm technologies. phpass is used by WordPress, Vanilla, phpBB, Drupal, and many other applications for password hashing.


phpass utilizes three components for password hashing:

  • Hash algorithm (blowfish, DES, or MD5 in that order if available)
  • Salt (random unique salt generated for each password)
  • Iterations or password stretching (a specified number of iterations or rounds set as desired)

To obtain the highest level of security with phpass, the server must be running PHP version 5.3.0 or later. This is because particular PHP algorithm code is only included in 5.3.0 and later. Specifically recommended is PHP 5.3.0 or later with the Suhosin security hardening patch.

Ubuntu and Debian Linux include the Suhosin PHP patch via the package php5-suhosin. Red Hat Enterprise Linux 5 and 6 and likewise CentOS 5 and 6 do not include this patch by default and it must be compiled manually for those distributions. Note that Debian is considering removing Suhosin patched PHP from their distribution, so future patching may be required. Suhosin has unfortunately not been well maintained, so Debian and other distributions are removing its support.

Ubuntu 10.04 Server LTS (released 24 April 2010):

$ php -v

PHP 5.3.2-1ubuntu4.17 with Suhosin-Patch (cli) (built: Jun 19 2012 01:35:33)

Copyright (c) 1997-2009 The PHP Group

Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

If using PHP 5.3.0 or later with the Suhosin patch, phpass has the ability to hash with blowfish (CRYPT_BLOWFISH in PHP), falling back to DES hashes if using PHP 5.3.0 and no Suhosin patch (CRYPT_EXT_DES in PHP), and a final fallback to salted MD5 based hashes (known as portable hashes). phpass utilizes iterations and salt regardless of which algorithm is utilized.

Regarding salts, phpass takes care of the complexity of adding salt to hashes. The function HashPassword() generates an eight-character random salt for each password, encoding the salt into the returned hash value. The function CheckPassword() checks against the hash that includes the salt, and it just works.

For iterations or rounds, the exact number can be set as desired by the web application. For example Wordpress uses 8192 iterations and Drupal 7 uses 16384 iterations with phpass for password hashes.

Wordpress Hashes

Wordpress has chosen by default to use the final fallback in phpass known as 'portable hash' which are salted MD5 hashes. The file /wp-includes/pluggable.php outlines the call to 8192 iterations of MD5 from phpass. Remember that phpass also takes care of adding in the salt so salt is included with the hash for added security.

1411 function wp_hash_password($password) {

1412     global $wp_hasher;


1414     if ( empty($wp_hasher) ) {

1415     require_once( ABSPATH . 'wp-includes/class-phpass.php');

1416     // By default, use the portable hash from phpass

1417     $wp_hasher = new PasswordHash(8, true);

1418     }


1420     return $wp_hasher->HashPassword($password);

1421 }

1422 endif;

The file /wp-includes/class-phpass.php is more or less a copy of the phpass.php source that Wordpress calls. This file can be viewed at the following link:

A Wordpress 3.4.1 hash looks like the following:


The use of MD5 and the final fallback of phpass for Wordpress password hashing is undoubtedly a choice of compatibility. MD5 is the only hash algorithm able to be used with older versions of PHP (way back to 3.0.x) as well as current PHP versions so that Wordpress is able to install and run on virtually any PHP installation.

Change Wordpress Default Hashing Algorithm

It is possible to change preferred algorithms for Wordpress to a stronger choice than MD5. The following page outlines the needed change to /wp-includes/pluggable.php to use to blowfish if available, then falling back to DES with 16384 iterations. All users would need to change their passwords after this edit to be rehashed with the new algorithm:

$wp_hasher = new PasswordHash(16, FALSE);

$hashedPassword = wp_hash_password($password);

Other Wordpress User Account Information

Regarding user information, the Wordpress username, user email, as well as display name are not hashed and appear in plain text in the database.

mysql> SELECT * FROM wp_users;


| ID | user_login | user_pass     | user_nicename | user_email     |


| 1 | admin     | $P$BrYSEUIBRRoSChUYfAj55gA3HtTXC80 | admin     | |


1 row in set (0.00 sec)


Salted MD5 with Iterations

The default salted MD5 hashes with 8192 iterations is perhaps the minimum security one would prefer for password hashes. MD5 is becoming more and more something to avoid if other options are available. For instance Linkedin passwords were stored in MD5 with no salt and were cracked easily within minutes. Salt and iterations significantly increases the strength and security, but unfortunately by still incorporating MD5, the current choice by the Wordpress project is problematic.

Tools such as "oclhashcat" are able to crack Wordpress phpass MD5 hashes with salt. This can also be done with "John the Ripper". Cracking phpass MD5 hashes is so common in the cracking community that these types of hashes have become a benchmark measurement to test GPU hardware. As GPU hardware becomes more and more powerful (and quickly available in large scale through cloud services), the time to crack hashes gets significantly lower.

The best course of action in using the default Wordpress configuration for password hashing is to use very long passwords. Passwords 24 characters in length significantly increase the time required to attempt cracking. An absolute minimum password length recommended by this author would be 12 characters in length.


If stronger password storage requirements are required by a company or organization in regards to running Wordpress, consider patching Wordpress to use blowfish or DES with 16384 iterations if available on the server as shown above. If this change is not possible, consider setting a password policy requiring very long passwords for Wordpress. A minimum password of 12 characters in length with 24 characters being much more secure is the recommendation of this author.

For end users browsing the web and creating user accounts on various Wordpress sites, consider that the default configuration of Wordpress is storing passwords in salted MD5 which can be cracked. If someone was to obtain the wp_users table of a website, not only do they have usernames and password hashes, but also an associated email address. It is critical to use unique passwords for every site so that if a site is compromised, a re-used password does not then become a personal security issue.

Hopefully future versions of Wordpress will consider using stronger default algorithms for password hashing now that most all servers are running at least PHP 5.3.0. Outlining that a particular Wordpress version X.x.x and later requires PHP 5.3.0 or higher for 'password security' will certainly be a well received gesture and is recommended to the Wordpress project at this point. At any rate, using very long passwords is undoubtedly the best solution no matter what hashing algorithm is in place for a given website.


Last updated on:

Scott Miller is a contributor to InfoSec Institute. InfoSec Institute is a security training company in Illinois.

One thought on “A Closer Look at WordPress Password Hashes

  1. If using PHP 5.3.0 or later with the Suhosin patch, phpass has the ability to hash with blowfish (CRYPT_BLOWFISH in PHP), falling back to DES hashes if using PHP 5.3.0 and no Suhosin patch (CRYPT_EXT_DES in PHP), and a final fallback to salted MD5 based hashes (known as portable hashes). phpass utilizes iterations and salt regardless of which algorithm is utilized.

    I don’t believe that is entirely accurate. For instance my mac shows:

    PHP 5.4.4 (cli) (built: Jul 4 2012 17:28:56) Copyright (c) 1997-2012 The PHP GroupZend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
    And still appears to be using bcrypt even without the Suhosin patch, here is an example hash:

    The check for CRYPT_BLOWFISH and if you want portable hashes appears to be the determining factor for using blowfish.

Comments are closed.

Join 40,000 WordPress Astronauts

We will never spam you.
siteground coupon
Get 60% Off the No. 1 WordPress Hosting!