How to Tell if a Website Has Been Hacked and What to Do
Most site owners find out about a compromise from someone else. A customer emails to say the page redirects to a pharmacy ad. A browser shows a red warning screen. A hosting company suspends the account. By then the intruder may have been in for weeks. Knowing the usual signs lets you catch it sooner, and having a plan makes the cleanup less chaotic.
Signs that something is wrong
Some signs are obvious. Your home page is replaced with a message from the attacker, or visitors are sent to an unrelated site. Many compromises are quieter, because the attacker wants the site to keep running while it serves their purposes. Common signals include:
- Search results for your site show strange titles or descriptions, often in another language or about pills, gambling, or counterfeit goods.
- Your browser or search engine warns visitors that the site may be harmful.
- New administrator accounts appear that nobody on your team created.
- The site slows down sharply, or your host reports unusual CPU use or outbound traffic.
- Files have recent modification dates that you cannot explain, especially in upload folders or the site root.
- Your email from the domain starts landing in spam folders, or you get bounce messages for mail you never sent.
One trick worth knowing is cloaking. Malicious code sometimes shows the spam only to search engine crawlers or to visitors arriving from a search result, so the page looks normal when you type the address directly. Searching for your own domain on a search engine and clicking through from there can reveal what a direct visit hides.
Confirm before you panic
Not every glitch is an intrusion. A broken plugin update, an expired certificate, or a traffic spike can look similar. Google Search Console has a security issues report that lists problems Google has detected, and it is free to use once you verify ownership of the site. Online scanners can check a page for known malicious code, but they only see what is publicly visible, so a clean result does not prove the site is clean. Your host may also run server-side scans that look at the files themselves.
Contain it first
The first goal is to stop further harm. If your host offers it, put the site into maintenance mode or take it offline briefly so visitors are not exposed to malware. Then change passwords, but do it in the right order. If the attacker still has a way in, a new password may be captured again. Work from the account level down:
- Change the hosting control panel password and any FTP, SSH, or database passwords.
- Change the passwords for every admin account on the site itself, and remove accounts you do not recognize.
- Replace any API keys or secret keys stored in configuration files.
- Check that your own computer is free of malware, since stolen saved passwords are a common route in.
Take a full backup of the compromised site before you change anything else. It looks odd to back up an infected site, but you will want the evidence to work out how the attacker got in, and you may need it to recover content that is missing from older backups.
Cleaning up
There are two basic approaches. The first is restoring from a backup made before the infection. This is usually the fastest route, but only if you know when the compromise began, and only if you then fix the hole that let the attacker in. Otherwise the site will be hacked again.
The second is manual cleanup. For a content management system such as WordPress, that generally means reinstalling the core software from a fresh download, reinstalling plugins and themes from trusted sources, and then going through what remains: uploaded files, scheduled tasks, and the database. Backdoors are small scripts that let the attacker return, and they are often hidden in odd places with innocent-looking names. Removing the visible spam while leaving a backdoor is the most common reason for reinfection. If you are not comfortable reading code, this is the point where hiring a security professional or asking your host for help is reasonable.
Find the cause
Cleanup without a cause is temporary. The usual entry points are outdated software, a vulnerable plugin or theme, weak or reused passwords, and stolen credentials. Server logs can show which request first uploaded a suspicious file. Check the date the oldest bad file appeared and look at what traffic hit the server around that time. If a particular plugin was the route, remove it or replace it with a maintained alternative.
Getting warnings removed
If Google or another service flagged your site, you usually have to ask for a review after cleanup. Search Console has a process for requesting review of security issues, and you describe what you fixed. Reviews can take days, so do not repeat the request over and over.
Reducing the odds next time
No setup is immune, but a few habits make compromise less likely and recovery easier. Keep software, plugins, and themes updated, and delete the ones you do not use. Use unique, long passwords through a password manager, and turn on two-factor authentication for admin and hosting logins. Give each user the lowest level of access they need. Keep automatic backups stored away from the web server, and test a restore occasionally, since a backup you have never restored is an assumption. The Cybersecurity and Infrastructure Security Agency publishes plain-language guidance on strong passwords that is useful to share with anyone who has access to your site.
Finally, write down your response plan while things are calm: who has hosting access, where backups live, and who to call. During an incident, that one page saves a lot of guessing.