- September 3, 2026
- 16 minutes read
- 211 Views
First: assume the website is compromised
Do not immediately delete everything
Restrict access if necessary
Find out how the attacker got in
Check the website files
A compromised website may contain modified legitimate files, completely new files or both. Attackers often place malicious code where it is unlikely to attract attention. They may also use filenames that resemble normal system files. With WordPress, the core files can be compared against clean versions of WordPress. Plugins and themes can similarly be compared with trusted originals where those originals are available. However, custom themes and heavily modified websites require more care. Replacing everything indiscriminately could also remove legitimate development work. The database should be checked as well. Malicious code, spam links, administrator accounts and injected scripts can all exist in the database rather than the filesystem. A clean-looking file system therefore does not automatically mean the entire website is clean.
Look for persistence
One of the more frustrating aspects of website compromises is persistence. An attacker may leave several different ways of regaining access. Removing the most obvious malicious file may therefore appear to fix the problem, only for the website to become infected again a few hours or days later.
A proper review should look for unusual administrator accounts, scheduled tasks, modified server configuration, hidden scripts, unfamiliar database entries and other mechanisms that could restore the malicious code. This is also why simply installing a security plugin after an incident is not necessarily enough.
Security software can be useful, but it cannot automatically prove that every part of an already compromised environment is trustworthy again. The first malicious file you find is not necessarily the only malicious file. Quite often, it is not the most important one either.
Check the server, not only the website.
If several websites exist inside the same hosting account, the problem may not be limited to the website where the symptoms first appeared. A compromised account can sometimes allow malicious code to spread between websites. That means neighbouring installations, staging environments and forgotten old websites deserve attention too. An old WordPress installation sitting in a folder nobody remembers can still become the entry point into an otherwise well-maintained hosting account. This is something website owners often overlook because they naturally focus on the site visitors can see. From the server’s perspective, an old staging site or forgotten subdomain can be just as relevant as the main website. Removing unused websites and software is therefore part of security maintenance, not simply housekeeping.
Check Google Search Console
Search engines may discover a compromised website before its owner does. Google Search Console can show security issues, suspicious pages and other problems associated with the website. It is also worth manually checking what Google has indexed.
Try searching:
site:yourdomain.com
Look for unfamiliar titles, languages, products, casino pages, pharmaceutical pages or anything else that clearly does not belong there. Search spam is a common form of website compromise. Attackers insert large numbers of pages into a legitimate website in an attempt to benefit from the domain’s existing reputation. Sometimes these pages are difficult to spot because normal visitors never see them while browsing the website. They may exist primarily for search engines. Even after the website has been cleaned, those pages may remain visible in search results for some time.
Do not restore a backup blindly
Restoring yesterday’s backup sounds like an obvious solution. Sometimes it is.
But there is an important question:
When was the website actually compromised?
If the attacker gained access three weeks ago, yesterday’s backup may already contain the same malicious code. This is one of the easiest mistakes to make because restoring a backup can make the problem appear solved immediately. The website loads again. The strange redirect disappears. Everything looks normal. But if the vulnerability remains, or if the backup already contains the compromise, the website can simply be infected again. A backup is only useful as a clean recovery point if you have reasonable confidence that it predates the compromise. This is why keeping several generations of backups is considerably more useful than keeping only the most recent copy.
Update everything after the website is clean
Once the compromise has been removed and the entry point understood, outdated software should be updated.
This includes the CMS, plugins, themes and, where relevant, server-side software. Anything that is no longer maintained should be reconsidered entirely. A plugin that has not received an update in years may continue functioning perfectly while simultaneously becoming a security liability.
The same applies to old themes, forgotten integrations and abandoned administrator accounts.
There is often a tendency to leave old components alone because they still work.
From a security perspective, “it still works” is not the same thing as “it is still safe to run.”
Check the computers used to manage the website
Not every website compromise begins on the server. If credentials were stolen from a computer through malware, a malicious browser extension or another compromise, changing the server password from the same infected machine may simply give the attacker the new password. The computers used to administer important websites should therefore be treated as part of the security environment. Website security does not end at WordPress. It also includes the device used to log into WordPress, the browser storing passwords, the email account used for password resets and every other service capable of changing the website.
Think about customer data
If the website processes personal information, payments, customer accounts or other sensitive data, the incident may have implications beyond restoring the website. You may need to establish what information was accessible, whether it was actually accessed, how long the compromise existed and what legal or contractual obligations apply. For organisations operating in the EU, a personal-data breach can also create obligations under the GDPR. Not every compromised website automatically becomes a reportable personal-data breach, but the possibility should not be ignored. The technical investigation should therefore answer more than simply: Does the homepage work again?
A functioning homepage tells you very little about whether data was accessed or what happened before the website was restored.
After recovery, reduce the attack surface
The best time to reconsider website security is immediately after seeing how many different systems are involved. A sensible setup usually means fewer unnecessary components, fewer privileged users, current software, strong authentication, reliable backups and proper monitoring. Unused plugins should be removed rather than merely deactivated. Old accounts should disappear. Administrator access should be limited to people who actually need it. Backups should exist outside the production server. Updates should be part of normal maintenance rather than something that happens after a problem appears. Security is often less about adding another plugin and more about removing things that should no longer be there.
A compromised website is not necessarily a lost website
Seeing an unfamiliar page where your business website used to be can make the situation look worse than it is. In many cases, the website itself can be recovered. The more difficult question is establishing exactly what happened and making sure it cannot immediately happen again. That means recovery is not simply about removing whatever looks suspicious. It is about preserving what matters, identifying the entry point, removing the compromise, checking for persistence, securing every relevant account and understanding whether anything beyond the website itself has been affected.
In practice, the visible malware is often the easiest thing to remove. The real job is finding the reason it was possible in the first place.


