I regularly clean hacked sites on WordPress, OpenCart, and custom-built CMSs. Almost always, the owner is the last to learn about the hack: from a client who was redirected to a casino on their phone, from the hosting provider that blocked the account, or from Google, which flagged the site as dangerous. Below is the procedure that preserves data and keeps the attacker from coming back.
How to tell that a site has been hacked
- From mobile or from search, the site redirects to a third-party resource, but when visited directly from a computer, everything is fine.
- In Google, a search for
site:вашсайтshows pages with Japanese or Chinese titles, casinos, and medicines. - The browser shows a red warning, and Search Console has a Security Issues section.
- Unfamiliar administrators have appeared in the admin panel.
- The hosting provider reports spam mailings or high load.
- Clients complain about card charges after paying on the site.
- Files with suspicious names and recent modification dates have appeared on the server.
First hour: stop the damage
- Make a full copy of the files and database in their current, infected state. You need it to find the entry point. Store it separately from working backups.
- Save the server logs: access.log and error.log for recent weeks. Many hosts keep them for only a few days.
- Change passwords: hosting, FTP and SSH, database, CMS admin panel, domain email, domain registrar. Start with email: it is used to recover all other access.
- Enable maintenance mode or password-protect the site if it is stealing card data or sending viruses. For a store this is painful, but it is the lesser evil.
- Remove extra administrators and end all active sessions.
First 6 hours: find how they got in
Without this step, cleaning is useless. Typical entry points on small business sites:
| Entry point | How to check |
|---|---|
| Outdated plugin or module | compare versions with vulnerability databases, for example WPScan for WordPress |
| Nulled theme or hacked module | look in the code for obfuscated inserts, calls to eval and base64_decode |
| Stolen password | admin panel and hosting login log, logins from unfamiliar IPs and countries |
| Neighboring site on the hosting | several sites in one account without isolation are infected at the same time |
| File upload | PHP files in image and upload folders |
| Open backups and configs | archives, .env, .git in the site root |
Look in the logs for the first requests to malicious files: usually nearby you can see which address was used to upload them. Compare the files with a clean version of the same CMS version: anything that differs and is not your own customization is suspicious.
First 24 hours: clean up and close the door
- Replace the CMS core, themes, and plugins with clean copies from official sources.
- Remove shells, backdoors, and inserts in the database: scripts in settings, widgets, and product descriptions.
- Update everything to current versions and remove unused plugins and themes.
- Close the entry point you found.
- Set correct file permissions and block PHP execution in upload folders.
- Check the site as a search bot and from mobile: some viruses show only to them.
- In Search Console, submit a review request in the "Security Issues" section.
If customer data was stolen
If there are signs that personal data or card data leaked, this is no longer just a technical task. Notify the acquiring bank and the payment system if a skimmer was on the payment page. Consult a lawyer about how and whom to notify under your country's law. Honest notification of customers preserves more trust than silence that later comes to light.
How to prevent it from happening again
- Update the CMS and plugins weekly or at least once a month.
- Two-factor authentication in the admin panel, on hosting and in email.
- Daily off-server backups with restore testing.
- Monitor file changes and get alerts about new administrators.
- Protect the admin panel and forms with a WAF. For setup details, see website protection from DDoS and bots.
- Security audit once a year and after major changes.
Why there are more hacks
AI has sped up both sides. Attackers take apart released fixes in minutes and write attack code for old plugin versions. Mass scanners check millions of sites a day. A site that has not been updated for six months almost certainly contains a known vulnerability, and a bot will find it before you do. The good news: most such attacks are stopped by updates, two-factor authentication and backups.
When to call a specialist
You can handle a simple infection yourself if you are confident working with files and the database. Call a specialist if the site makes money every day, has card payments, the infection came back after cleaning, or Google is already showing a warning. I provide website malware removal with finding the entry point and a security audit to find the other weak spots.
FAQ
What to do first if your site was hacked?
Make a copy of the infected site and logs, change all passwords starting with email, remove extra administrators, and if needed put the site into maintenance mode. Restoring a backup and cleaning the site should only be done after finding the entry point.
Can I just restore an old backup?
You can as a temporary measure, but the vulnerability will remain, and the site will be infected again. You will also lose orders and changes made since the backup date. First find out how they got in, then restore and close the hole immediately.
How do I remove Google's hacked site warning?
Clean the site, close the vulnerability, and submit a request for review in Search Console under 'Security Issues'. The review usually takes from one to several days.
How much does it cost to fix a hacked site?
Fixing a site on a CMS with entry point investigation usually costs from $150. The price is higher if several sites on the hosting are infected, there is custom code, or data needs to be recovered from damaged files.
Why was the site hacked if no one needs it?
Most attacks are automated. Bots look for known vulnerabilities across all sites and use hacked sites for spam, redirects, and attacks on other resources. Business size does not matter.
Let’s talk about your project
Describe the task in a couple of sentences — I reply within one business day. Free and no obligation.
Telegram Discuss a project