You visit your WordPress site and, wait a minute…it looks different. There were some changes made that you didn’t create yourself. So, you go to log in to take a peek around and fix the issues. However, it’s not letting you log in. Uh-oh. It looks like your WordPress site was (gulp!) hacked.
As concerning as that is, take a deep breath, relax, and know that there’s a path to get your website back into your control from hackers. And we’ll break it all down for you in this article.
Along the way, you’ll see how to resolve many hacking issues for free with the help of our WordPress security plugin, Defender.
I’ll be going over:
- Reasons Your WordPress Site was Hacked
- Signs You’ve Been Hacked
- 13 Things You Can Do Once You Know You’ve Been Hacked
- How to Clean a Hacked WordPress Site with Defender
- Getting Your Site Off of Google Safe Browsing List
Plus, there’ll be some resources to prevent this from happening in the first place.
After reading this article, you’ll be able to be prepared for any hackers, know how to handle an attack, get your site under your control in no time — and breathe a sigh of relief.
All websites are susceptible to hacking, not just WordPress sites.
WordPress, in fact, is quite a secure platform. So, just because you’re using WordPress isn’t the only reason you might become a victim.
The thing is, WordPress is so popular that WordPress sites are frequently the target of hackers. There are just many WordPress sites worldwide, making the odds go up.
With that in mind, why do sites get hacked?
Hackers have their reasons. It could be because they want to use your WordPress site to attack other sites. Or, possibly the hacker has malicious intentions, like stealing personal data.
There’s a multitude of objectives why sites get hacked. Sometimes, it’s just a fun activity for a hacker to do on a Sunday afternoon while sipping on a mocha.
And it’s done in many ways, too.
It might just boil down to someone having your WordPress admin username and password. Or, it might be that you have insecure web hosting, which makes your site vulnerable to hacking attempts.
Plus, if your site is vulnerable, it’s more prone to attacks.
Here are several reasons why your site may have been targeted:
Weak Passwords: Most brute force attacks rely on weak or easily guessable login passwords (e.g. passwords related to names, places, birthdates, or mobile numbers).
Incorrect File Permissions: File permissions consists of a set of rules used by your web server. They assist your web server control access to files on your website. If you have incorrect file permissions, it can give a hacker access to change your files.
Outdated WordPress Theme or Plugins: If you have an outdated theme or plugins, they’re frequently littered with security flaws and bugs, making your site vulnerable.
WordPress Isn’t Updated: It’s vital to keep your WordPress up-to-date. What’s important to know is WordPress releases new updates for a reason. New versions of WordPress fix security issues and bugs.
All this goes without saying if you have a WordPress site — you can be hacked. However, with adequate prevention, it’s more likely to avoid hacking attempts and keep your site safe.
For more information about keeping your site secure, check our article on ways to secure your WordPress site for free.
As I mentioned in the introduction, you may notice things aren’t right. After all, it’s your website, and you’re used to how it looks and functions — so you catch on quickly when things look weird.
Sometimes, it’s harder to catch that your site has been hacked (e.g. malicious code); however, the signs are usually pretty clear.
Here are some sure signs that your WordPress site was hacked. There’s also a quick explanation of why this may have happened, along with the reasons.
- Your Site Redirects to Another Site: A redirect can occur when a hacker adds a script that redirects people to another site when they visit yours.
- You Can’t Log In: Before jumping to conclusions about being hacked, make sure it’s not a matter of you just forgetting your password. If you conclude that forgetting your password is not the case, a hacker may have changed your password to prevent access or removed your account.
- Sudden Drop in Traffic: This can happen if malware and trojans hijack your WordPress site’s traffic and have it redirected. Traffic drops also occur if you end up on Google’s blocklists, which can be the case if your site gets hacked.
- Your Site was Changed: Change of a homepage to a static page links to unsavory sites, or a footer with links that you didn’t add, are all good signs of hacking. Site changes can happen if a hacker gains access to your admin. Be sure to check with any administers that have access to your site to confirm that they didn’t make the changes themselves.
- Bad Links Added to Your Website: Same as your site being change, this can happen if a hacker gets access to your admin.
- Unknown File Scripts: If you find this, it could mean your website was compromised by a hacker who added malware or some other malicious software. This can happen if your website is susceptible to attacks (e.g. outdated, insecure theme).
- Suspicious User Accounts in WordPress: Your site may be compromised, and a hacker created a new account in the admin. If you have a registration option on your site, be sure to double-check that to ensure it’s not just a user. Typically, a hacker account will have an administrator role.
- You Get Notifications from Defender: Our answer to security, Defender, will give you detailed security reports and lets you know about suspicious activity. If some red flags occur, you may have been hacked.
- Slow or Unresponsive Website: A DDoS attack can cause this. Check out this article to learn more about how and why they occur.
- Google Gives a Warning that Your Site May be Hacked when Searched: Google may display a warning sign when your site is searched. This might be an indication that your WordPress sitemap has been hacked.
If you’ve noticed one or more of these signs and feel like your site may have been hacked, it’s crucial to take action as quickly as possible. Let’s take a look at what to do next.
There are several steps you can take once you believe you’ve been hacked. Keep in mind that some of these steps may not be necessary. It all depends on what kind of attack from a hacker occurred.
These steps should give you a clear path, regardless of attack, on ways to get back in control of your WordPress site as quickly as possible.
- Don’t Stress: It’s essential to relax and be as clear-headed as possible when fixing a hacked site. Meditate, have a moment of Zen, or do whatever you can to try not to stress out about the situation. It’ll more than likely be okay, and you need to focus on getting things fixed.
- Reinstall WordPress Core: You might need to reinstall WordPress if the WordPress core files were compromised. A new installation will replace them. You can read more about reinstalling WordPress in this article.
- Reinstall Plugins and Themes: If you updated your plugins and themes and are still experiencing issues, delete them, and then have them reinstalled. If you question whether the plugin or theme is secure, be sure to investigate how updated it is and use your best judgment on whether to continue using it. If it was a free plugin or theme, you might want to reconsider installing it and opt for a premium version or an updated plugin or theme from the WordPress plugin or theme directory. Bottom line: make sure whatever theme or plugin you reinstall is updated, safe, and won’t be the cause of any security issues.
- Backup Your Site Immediately: A premium plugin like Snapshot Pro is an easy way to backup your site. Just ensure you have it backed up before tackling any hacking issues.
- Locate What Was Hacked: Do a rundown of the issue(s) and determine what the hack is (see the list above).
- Put Your WordPress Site in Maintenance Mode: To ensure visitors don’t see your site in a compromised state, put your site in maintenance mode with the help of a plugin like Branda. Of course, if you can’t log in, this can’t be possible. When you can log in again, and there’s still some cleaning up to do, then put it in maintenance mode at that time. Also, in some cases, it’s better if the site is turned off completely to prevent any access. That way you can avoid running any PHP code. For example, if the malware runs code on each WordPress load, putting it in maintenance mode won’t change a thing, as visitors might still open the site and the maintenance mode still triggers a WordPress load. Therefore, you end up cleaning and the code is getting re-added, which leads to a never-ending cycle.
- Contact Your Hosting Company: Good hosting companies can help determine the situation and advise. For example, they might be able to tell you where the hackers found their way in from. If you host your site(s) with us, we offer 24/7 customer support to assist with any hacking issues, including cleanup for infected sites.
- Contact Support: If you’re with a website support management company, it might be best to contact support before proceeding with DIY repairs, depending on the level of hacking. Like with our hosting, we have 24/7 support for all WPMU DEV members and can guide you through what’s best to do in your situation. Contacting support is good to do early or if you try to fix the issue independently and can’t.
- Reset Your Passwords: If you can access your admin, change all of your passwords. This ensures that a hacker can’t use your password if that was how it gained entry. Choose a strong password for your login, and reset the SFTP, database, and hosting password with your provider as well. Also, consider limiting the number of login attempts, and enabling two-factor authentication.
- Update Plugins and Themes: Ensure that all of your plugins and themes are up to date. It’s vital to tackle this before trying other fixes. If it’s a plugin or theme that’s the culprit, any other fixes you may try may be undone by the vulnerabilities.
- Remove Users: Search your users in the WordPress admin and remove any users you don’t recognize.
- Get Rid of Unwanted Files: Our plugin, Defender, can scan for files that may be from hackers. It’s important to remove these corrupt files as quickly as possible (more on this to come). Just be sure they are unnecessary files before deleting them.
- Clean Your Database: You’ll want to clean this up if your database was hacked. This will ensure that you have less stale data and aren’t taking up a lot of space, which in return will make your site faster.
Following some of these necessary steps will help you get your site back in no time from the grasp of a hacker that wreaked havoc on it.
That being said, it can’t be emphasized enough to make sure that you know how to clean up your website the right way after a hacker attacks it. The goal of cleaning up your site after an attack is to get it back the way you had it, so you don’t want to wreck your site trying to do it yourself if you’re not sure how.
If you have any questions on what to do, it’s important to contact support or get in touch with a professional.
Luckily, depending on the type of hack, a lot can be done with our free security plugin, Defender. He’s been mentioned already several times throughout this article, and here’s a detailed look at what he can do after an attack.
This section is a four-step guide if it appears malware may be the cause of the hacking.
Here are the steps we’ll be taking:
- Scanning for Malware in One-Click
- Deleting Infected Files
- Running Another Scan
- Setting Up Notifications and Schedule Automated Scans
Keep in mind that Defender works as a great preventative measure as well, so you don’t get hacked in the first place. To get a glimpse at what all he can do, be sure to read our article on getting the most out of Defender.
If you were hacked, let’s check out what you can do to clean up the mess with Defender.
To determine if malware might be an issue with your website, the first thing to do is scan WordPress’s core files for malicious code.
That’s done from Defender’s dashboard by tapping New Scan.
It will be just a few moments for Defender to check out your site’s core files for malware.
If any issues are detected, Defender will let you know how many were found.
Please note that the free version of Defender will scan WordPress’s core files. If you want him to scan other areas, you’re able to with Defender Pro. Defender Pro’s additional scanning includes:
Plugins & Themes: Plugins and themes are scanned for known, publicly-reported vulnerabilities.
Suspicious Code: Crank-up scanning a notch by scanning all site files for suspicious PHP functions and code.
Since we detected some issues, let’s get them taken care of.
And for more on scanning your WordPress site for malware, check out this article.
After a scan, you can easily find all of the issues that Defender spotted in the admin’s Issues section.
Here, Defender discloses the issue. He will tell you detailed and specific information, including:
- Issue Details: A brief description of the issue and a snippet of code
- Location: Where the issue’s file path is located
- Size: The suspicious file’s size
- Date Added: This shows the date and time that the code was added to the WordPress site.
You then have the option to Delete or Ignore the code.
If you want to get rid of the issue immediately, you can in one-click by hitting the Delete File button.
If you decide to delete the file, it will be deleted permanently. The bad code will no longer be a problem.
Plus, you can delete things in bulk if there are numerous issues.
Wiping-out bad code can’t get much easier after a hacker attacks your site.
A note of caution: It’s important to be 100% sure that something is harmless before deleting and/or ignoring it. Contact one of our experts 24/7 if you’re unsure or need advice.
Please read our article about finding and deleting suspicious code with Defender for more detailed information.
If you deleted suspicious code from your site, just like you ran a scan the first time, do it again to ensure that all of the issues are taken care of.
Ensure that you stay on top of any hacking activity by setting up notifications and automated scans in Defender. It’s easy to do and one of the most effective ways to know if you’ve been hacked.
In the Notifications section, you can configure what notifications you want to enable, add recipients for the notifications, schedule reports, and configure reports.
You can set up the Notifications for:
- Security Recommendations
- Malware Scanning
And you can set up Reporting for:
- Malware Scanning
- Audit Logging
Enable notifications individually or in bulk.
Choose what notifications and reporting you want: Individually or in bulk.
Set up users you have in your admin, or invite by email, that you’d like to receive notifications.
You can schedule Security Notifications to be delivered daily, weekly, or monthly.
When it comes to Reporting, customize the frequency, day of the week, and time to deliver reports.
You’re now set up to be aware of malware hacking issues and immediately take care of them.
Once you have your site back in your hands and cleaned-up from any destruction a hacker caused, it’s essential to make sure you’re not on Google’s Safe Browsing List. If you are, it’s vital to get off it.
Luckily, it’s quick and easy to do. There are six main steps to take
- Begin by signing-in to Google Webmaster Tools.
- Add your WordPress site if you haven’t already.
- Follow Google’s instructions and verify your site.
- Select your site on the Webmaster Tools home page.
- Click on Site status, and then Malware.
- Click on Request a review.
After you submit a request to have your site reviewed, the timeline for the review to be processed varies depending on what type of attack you had. Here’s a look at the different timelines for review process times:
Hacked with Spam: Several weeks
Malware: A few days
Phishing: A day
Once Google determines that your site is clean, warnings from browsers and search results will more than likely be removed within 72 hours.
If your site request wasn’t approved, be sure to reassess your site for malware, spam, or any modifications that may have been caused by a hacker. Then, you can always submit it again for review.
You wake up and go to your website’s URL. After taking a look around, it’s perfect. Everything is in order, and there’s no evidence of a hack anywhere. Whew! It looks like you cleaned-up the hacker’s mess, and you’re protected a bit better now.
Hopefully, it won’t happen, but if a hacker does attack again, you’ll be ready to move quickly and get your site back with ease. With plugins like Defender and the tips mentioned in the article, the process of getting your site back into your control usually isn’t as daunting as you might think.
We have a lot more information about cleaning up your site after a hacking. After all, it can leave a mark. It’s not as simple as grabbing some rubber gloves and stain remover to make your site nice and shiny again.
Be sure to read our article How I Cleaned Up My Site After it Was Hacked and Blocklisted, and Have You Been Hacked? How to Clean Your Site and Get Off Google’s Blocklist.
Also, this is #SecurityMonth, so you can currently get 35% off your first year of our Security & Backups Pack featuring Defender Pro, Snapshot Pro, Shipper Pro, and Automate to help clean up your security. Click on the coupon below to unlock the exclusive deal.
With what we’ve mentioned in this article and our other resources, you should have your WordPress site clean in no time.
WPMU DEV Blog – Read More