Beginner’s Guide to Fixing Your Hacked WordPress Site

A sad reality about running websites is that sometimes they could get hacked. Having our WordPress site hacked a few times in the past, we know exactly how stressful it can be. Not to mention the impact it has on your business and readership.

Over the past few years, we have helped hundreds of users recover their hacked WordPress sites including several well-known businesses.

In this article, we will share a step by step guide to fixing your hacked WordPress site.

Fix your Hacked WordPress Site

Few Things to Know Before We Start

First and foremost, no matter which platform you’re using, whether it’s WordPress, Drupal, Joomla, etc., any site can be hacked!

When your WordPress site is hacked, you can lose your search engine rankings, expose your readers to viruses, have your reputation tarnished due to redirects to shady websites, and worse, lose your entire site data.

If your website is a business, then security should be one of your top priorities.

That’s why it’s crucial that you have a good WordPress hosting company. If you can afford it, then absolutely use managed WordPress hosting, which will handle security for you.

Make sure that you always have a good WordPress backup solution such as Duplicator in place.

Last but probably the most important, have a robust web application firewall such as Sucuri. We use their services on our websites.

All the above information is great if you haven’t been hacked yet, but chances are if you’re reading this article, then it’s probably too late to add some of the precautions that we mentioned above. So before you do anything, try to remain as calm as you can.

Let’s take a look at the step by step guide on how to fix your hacked WordPress site.

Step 0 – Have a Professional Do it for You

Security is a serious matter, and if you’re not comfortable dealing with codes and servers, then it’s almost always better to have a professional do it.

Why? Because hackers hide their scripts in multiple locations allowing for hacks to come back over and over again.

Although we’ll show you how to find and remove them later in this article, a lot of folks want to have the peace of mind knowing an expert properly cleaned their website.

Security experts normally charge anywhere between $100 to $250 per hour which is outrageous for a small business or solo-entrepreneur.

However, WPBeginner Pro Services offers hacked site repair for a one-time payment of $249. This service includes premium files determination, malicious code removal, software and security updates, and a cleaned site backup.

WPBeginner Pro Services
Beginner’s Guide to Fixing Your Hacked WordPress Site 1

Plus, we’ll cover your website for 30 days after the repair. That means, if you get hacked again, we’ll be there to fix it. We also guarantee to fix your site or you’ll get 100% of your money back.

Our dedicated experts at WPBeginner Pro Services have been cleaning and securing WordPress websites for 10+ years. So you can be sure that your site is in good hands.

If you value your time, you’re not tech-savvy, or if you just want peace of mind, then you can use our Hacked Site Repair service.

For all the DIY folks, simply follow the steps below to clean up your hacked WordPress site.

Step 1. Identify the Hack

When dealing with a website hack, you’re under a lot of stress. Try to remain calm and write down everything that you can about the hack.

Below is a good checklist to run down through:

  • Can you login to your WordPress admin panel?
  • Is your WordPress site redirecting to another website?
  • Does your WordPress site contain illegitimate links?
  • Is Google marking your website as insecure?

Write down the list because this will help you as you talk with your hosting company or even as you go down the steps below to fix your site.

Also it’s crucial that you change your passwords before you start the clean up. You will also need to change your passwords, when you’re done cleaning the hack.

Step 2. Check with your Hosting Company

Most good hosting providers are very helpful in these situations. The have experienced staff who deal with these kind of things on a daily basis, and they know their hosting environment which means they can guide you better. Start by contacting your web host and follow their instructions.

Sometimes the hack may have affected more than just your site, specially if you are on shared hosting. Your hosting provider may also be able to give you additional information about the hack such as how it originated, where the backdoor is hiding, etc.

From our experience, SiteGround and HostGator both are very helpful when something like this happens.

You may even get lucky and the host might clean up the hack for you.

Step 3. Restore from Backup

If you have backups for your WordPress site, then it may be best to restore from an earlier point when the site wasn’t hacked. If you can do this, then you’re golden.

See our tutorial on how to restore WordPress from backup for step-by-step instructions.

However, if you have a blog with daily content, then you risk losing blog posts, new comments, etc. In those cases, weigh the pros and cons.

Worst case, if you don’t have a backup, or your website had been hacked for a long time, and you don’t want to lose the content, then you can manually remove the hack.

Step 4. Malware Scanning and Removal

Look at your WordPress site and delete any inactive WordPress themes and plugins. More often than not, this is where hackers hide their backdoor.

Backdoor is referred to a method of bypassing normal authentication and gaining the ability to remotely access the server while remaining undetected. Most smart hackers always upload the backdoor as the first thing. This allows them to regain access even after you find and remove the exploited plugin.

Once you have done that, now go ahead and scan your website for the hacks.

We recommend installing the Sucuri plugin on your website. This plugin helped us block 450,000 WordPress attacks in 3 months, including 29,690 backdoor related attacks.

Attacks blocked by Sucuri
Beginner’s Guide to Fixing Your Hacked WordPress Site 2

There’s a free version of Sucuri that comes with malware scanning, security hardening, and tools to check the integrity of the core WordPress files. The premium version includes advanced features like daily server side scanning that checks every single file for backdoors and other security issues.

Once the plugin is installed and activated, the Sucuri scanner will tell you the integrity status of all your core WordPress files. In other words, it shows you where the hack is hiding.

The most common places are themes and plugin directories, uploads directory, wp-config.php, wp-includes directory, and .htaccess file.

You have two options for fixing the hack here. You can either manually remove the code, or you can replace that file with the original file.

For example, if they modified your core WordPress files, then re-upload brand new WordPress files from a fresh download or all WordPress files for that matter to override any affected files.

Same goes for your theme files. Download a fresh copy and override the corrupted files with the new ones. Remember do this only if you didn’t make changes in your WordPress theme codes otherwise you’ll lose those.

Repeat this step for any affected plugins as well.

You also want to make sure that your theme and plugin folder matches the original ones. Sometimes hackers add additional files that look like the plugin file name, and are easy to ignore such as: hell0.php, Adm1n.php, etc.

We have a detailed guide on how to find a backdoor in WordPress and remove it.

Keep repeating this step until the hack is gone.

Step 5. Check User Permissions

Look in the users section of WordPress to make sure only you and your trusted team members have administrator access to the site.

If you see a suspicious user there, then delete them.

You can read our beginner’s guide to WordPress user roles for more details.

Step 6. Change Your Secret Keys

Since WordPress 3.1, WordPress generates a set of security keys which encrypt your passwords. Now if a user stole your password, and they are still logged into the site, then they will remain logged in because their cookies are valid.

To disable the cookies, you have to create a new set of secret keys. You need to generate a new security key and add it in your wp-config.php file.

Step 7. Change Your Passwords AGAIN

Yes, you changed the passwords in step 1. Now do it again!

You need to update your WordPress password, cPanel / FTP / MySQL password, and basically anywhere else that you used this password.

We highly recommend that you use a strong password. Read our article on the best way to manage passwords.

If you have a lot of users on your site, then you may want to force a password reset for all of them.

Moving Forward – Hardening your WordPress site

Improve WordPress Security

It should go without saying that there is no better security than having a good backup solution in place. If you don’t have one, then please put something in place to backup your site daily.

Aside from that, here are some more things you can do to better protect your site – these are not in order and you should do as many as you can!

  • Setup a Website Firewall and Monitoring System – Sucuri is the provider we use because in most cases they block the attacks before it reaches your server.
  • Switch to Managed WordPress Hosting – Most managed WordPress hosting companies go to extra lengths to keeping your site secure. We recommend SiteGround or WPEngine.
  • Disable Theme and Plugin Editors – It’s a best practice. Here’s how to disable theme and plugin editors in WordPress.
  • Limit Login Attempts in WordPress – We recently covered the importance of it and you should read how to limit login attempts in WordPress.
  • Password Protect your Admin Directory – Add an additional layer of password to your WordPress admin area. See how to password protect your WordPress admin.
  • Disable PHP Execution in certain directories – Adds additional layer of security – here’s how to disable PHP execution via .htaccess.

And whatever you do, always keep your WordPress core, plugins, and themes up to date! For more details, see our guide on the proper update order.

Remember Google recently announced that they added a new change in the algorithm to that impacts hacked sites with spam results. So please make sure that you are keeping your site secure.

We hope this guide helped you fix your hacked WordPress site. If you’re still having issues, then we strongly recommend hiring professional help such as Seahawk or ask your hosting company if they can help with the fix. You may also want to see our ultimate WordPress security guide or our expert picks of the best WordPress security plugins.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Lượt xem: 17

Để lại một bình luận

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *