Finding out that your website has been hacked is stressful, but most sites can be cleaned and recovered. The order of the steps matters more than speed, so work through them calmly. The advice below follows the WordPress project's guide, My site was hacked, and Google's help for site owners.
Before you start
- Your hosting account details and, if it is a WordPress site, an administrator login.
- A clean computer or phone. If your own device has a virus, attackers can steal new passwords as you type them. Time: one to three hours. Difficulty: intermediate.
Not sure the site is hacked, or just down? Start with is my website down.
Signs of a hacked site
- Pages or links you did not create, often selling something unrelated.
- Visitors sent to another site, or a browser warning about a dangerous site.
- New administrator users you do not recognise.
- Search results for your site showing odd titles or a warning label. Google's Search Console has a Security issues report for this, with types such as hacked content, malware and deceptive pages.
- Your host telling you about malware.
Step 1: Stay calm and write things down
By the end of this step you will have a record of what is happening.
- Note what you see, with the date, time and time zone you noticed it.
- Note anything you changed recently, such as a new plugin, a theme edit or a new user.
- Take screenshots of strange pages.
Check: you can describe the problem and when it started.
Step 2: Tell your host
By the end of this step your host knows, and you know whether other things are affected.
- Contact your hosting support through the quickest channel and describe what you wrote down. If you are with Server Salad, contact our team.
- Ask whether other sites on the account are affected and whether they can restore a backup from before the problem began.
Check: you have a reply and know what your host can do on the server side.
Step 3: Scan your computer
By the end of this step you will know your own device is clean. WordPress notes that attackers often get passwords from malware on a local computer.
- Run a full scan with a trusted antivirus tool.
- If it finds nothing but you are still unsure, try a second scanner.
Check: the scan finishes with no threats, or you have removed what it found.
Step 4: Change every password
By the end of this step old logins will no longer work. Use strong, unique passwords and turn on two-step sign-in where you can.
- Change the passwords for hosting control panel, WordPress administrators, email accounts, FTP or SFTP and the database.
- Remove any users you do not recognise.
- In WordPress, you can also regenerate the secret keys in
wp-config.php, which signs out everyone who is logged in.
Check: only people you know can log in.
Step 5: Restore or clean
By the end of this step the site files are free of the problem.
- The quickest fix is often to restore a backup made before the hack. Take a copy of the current state first, so you can investigate later. Our article on why backups matter explains why daily copies help here.
- If there is no clean backup, WordPress recommends reinstalling the core folders
wp-adminandwp-includesfrom a fresh download of the same version, then checkingwp-content,.htaccessand files such asfunctions.phpfor code you do not recognise. - Delete plugins and themes you do not use, then reinstall the rest from their official sources.
Check: a fresh scan finds nothing and the strange pages are gone.
Step 6: Update and tighten
By the end of this step the hole the attacker used is closed.
- Update WordPress, plugins and your theme. See how to update plugins and themes safely.
- Change the passwords again now that the site is clean.
- Follow WordPress security basics so it does not happen twice.
Check: nothing is waiting on the Updates page and every login uses a new password.
Step 7: Ask Google to review the site
Skip this step if you had no warning in search or in Search Console. If you did, the Security issues report shows how to fix and request a review.
- Fix all the issues listed, on all affected pages. Google does not give partial credit.
- Choose Request Review and explain what the problem was and what you did.
- Do not submit another request while one is pending. Reviews usually take from a few days to a few weeks.
Check: you receive an email that the request was received, and a second when the review is done.
What success looks like
The strange pages are gone, scans are clean, only people you know can log in, everything is updated and you have a fresh backup.
Common problems
The hack comes back. Something was missed, often a backdoor file or a plugin that is still out of date. Scan again, check the user list and ask your host to look at the server logs.
You cannot log in to WordPress. Ask your host to help you reset the administrator password from the database.
The browser still shows a warning. It can take time for warnings to clear. Fix everything first, then request a review if Search Console shows an issue.
FAQ
Should I pay someone to clean the site?
If you cannot find the problem or the site makes money, professional help is reasonable. Check what they will do and what they will not, and ask for the work in writing.
Will my host fix it for me?
It depends on the host and plan, so ask. Server Salad plans include cPGuard malware scanning, as listed in what is included, but you still need to follow the steps above to close the hole.
Can I prevent this?
You can lower the chance a lot: keep software updated, use strong passwords and keep backups. Prevention is covered in WordPress security basics.
