3

WordPress forgotten password localhost hack

 3 years ago
source link: https://dev.to/thomasxbanks/wordpress-forgotten-password-localhost-hack-4aj5
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
Cover image for WordPress forgotten password localhost hack

WordPress forgotten password localhost hack

Jun 11 Originally published at thomasxbanks.com on Jun 11

・2 min read

I have lost count of the number of times I've forgotten the password to the local or development CMS.

My natural instinct is to click the Forgot Password link but, obviously, there's no way to trigger that email from the local system.

I've spent too long hunting through articles on how to recover the forgotten password. The quickest and easiest solution that I've found is to change the password manually in the database.

A hacker wearing an Anonymous mask hacks into a WordPress blog. Possibly.

How do we do that then?

WordPress stores passwords in the wp_users table. The prefix may be different if you have elected to change that in the wp-config.php file. It's good practice to do that for security.

When you look at the table, it'll look a little like this…

ID user_login user_pass 1 thomasxbanks $P$BHpcLw/aWsTPmeDprzXwOEl45bJm9A3

WordPress stores your password as an MD5 hashed string. This prevents anyone with access to the database seeing confidential information in plain text.

If this wasn't obfuscated like this, we'd be able to copy our password and paste it into the login form…but we can't - and for good reason!

So, to fix our little problem, we need to replace the existing hashed password with a new hashed password - we can't overwrite the MD5 hash with plain text because that won't work.

I have Hasher installed as a plugin in VS Code. If you don't use VS Code or don't want to use this extension, MD5 Hash Generator Online works pretty well.

I would recommend that you don't create your "forever password" using these hash generators though. Overwrite the existing password with something easy to remember and very, very temporary - a favourite of mine is Pa55word!

267057150e34eca5c6af39ec9b30864e
Enter fullscreen modeExit fullscreen mode

Once the password has been changed, you can log in with your new password and immediately change it to something more secure.

I hope this helps you as much as it has helped me. 😎


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK