My website is hacked. What to do: first limit the damage, then clean up. Close access to the site, call your host for logs and a backup, change every password, then remove the malicious code or restore a clean copy. The steps below run in that order.
| Step | What to do | Time |
|---|---|---|
| 1 | Confirm it is really a hack | 3-5 min |
| 2 | Close public access | 5 min |
| 3 | Call the host: logs, backup, suspension | 10-15 min |
| 4 | Save a copy of the hacked state | 15-30 min |
| 5 | Restore a clean backup or clean manually | 1-4 hours |
| 6 | Change all passwords | 10 min |
| 7 | Fix Search Console issues and request review | a few days to several weeks |
| 8 | Find how the attacker got in | next day |
| 9 | Set up protection | this hour |
A phone call on a Thursday evening: "Szymon, something's going on. The site froze, and now it's showing text I've never seen before."
Panic is natural, but it leads to rushed decisions. If you know the order to work in, the site can be back to normal within hours. More importantly, it stops harming your visitors and your position in search.
I've been working with businesses for over ten years and I've seen more injected code than I'd care to. Here is what to do in the first minutes after you find out, and in the days that follow.
Before you start
For most small sites, a compromise means a few hours of unpleasant work. Most of the risk sits in add-ons. Patchstack counted 11,334 new vulnerabilities in the WordPress ecosystem in 2025, a 42% increase on 2024, and 91% of them were found in plugins (Patchstack, State of WordPress Security in 2026).
Take a breath and sit down. You're about to make decisions where rushing costs more than waiting.
Step 1: Confirm it's really a hack (3-5 minutes)
Sometimes it looks like a hack, but it's a bug, a hosting problem, or something else.
What to do:
- Open the site in an incognito/private browser window (to avoid the cache)
- Check whether the problem shows on all devices (computer, phone)
- Check hosting access logs (if you have access to the panel)
- Ask someone else to look at the site (it may be a local issue on your computer or network)
Signs that it's really a hack:
- Site shows foreign content (ads, political posts, crypto scam, anything not yours)
- Site is completely changed
- Google warns that the site contains malware (check Google Search Console)
- Customers ask "What happened to your site?"
- Unexpected emails from your host or your backup system
If you confirm it's a hack, go to step 2.
Step 2: Close access right now (5 minutes)
Every minute an infected site stays reachable is a risk to your visitors, and a signal to Google that the site is unsafe. The second one takes weeks to undo.
Do this now:
- Disable database access or shut down the site completely. If you have hosting panel access (cPanel, Plesk), disable the site. On WordPress, add a rule to .htaccess that returns 403 Forbidden for the whole site. If you can't, go to step 3.
- If you can't shut down the entire site, at least disable the admin panel (/wp-admin for WordPress). Add a rule to .htaccess that blocks the wp-admin directory for everyone (Order allow,deny / Deny from all).
- If possible, change all passwords. Hosting panel, FTP, WordPress, and the email connected to the site. Everything.
Whoever got in most likely holds one of your passwords. While they do, they can keep coming back, and they can leave a way in that survives the removal of the malicious code itself.
Step 3: Contact your hosting provider (10-15 minutes)
Call. Don't email. Phone, immediately.
Say:
- Your site was hacked
- You want to temporarily shut down the site or the whole account, so the attacker can't continue
- They should check the access logs to find how the attacker got in
- They should restore a backup from before the hack
Good hosting has backups. That's your safety net. If you have a backup from 24 hours ago, you can restore the site to its state before the attack.
Questions worth asking:
- When was the last backup made?
- Can they identify the IP address or country the attack came from?
- Does the site have malware?
- Can I temporarily shut down the site?
Good hosting will cooperate. Bad hosting will say "sorry, I don't see a problem." If that happens, note it, find new hosting later, and focus on the rescue now.
Step 4: Make a full copy of the current state (15-30 minutes)
Even though the site is hacked, you want a copy of this state. A developer (me, or someone else) can examine it and find exactly what the attacker did. That helps prevent the next attack.
How to copy a hacked site:
- SSH to the server (if you have access) and use scp to copy all files
- Or log in via FTP and download all files to your computer
- Download the database (phpMyAdmin, then Export)
Keep this copy on a separate disk and don't overwrite it. It's evidence. It's what a developer needs to find the entry point.
Step 5: Restore from backup or clean (1-4 hours)
You have two paths.
Path A: Restore from a clean backup (preferred)
If the host has a backup from 24-48 hours ago, ask them to restore it. This is the simplest way.
Gain: the site returns to normal quickly.
Risk: if the backup is older than your latest changes (for example, you changed product prices yesterday and the backup is from the day before), those changes are lost. Restoring is a business decision: what hurts more, a hacker controlling the site, or losing 24 hours of data?
Path B: Manual cleaning (slower, but precise)
If you don't have a backup, or prefer not to restore, you must find and remove the malware by hand. This is work for a developer.
Where to look:
- Recently modified files (check the timestamps over FTP)
- PHP files in places where PHP shouldn't be (media folder, etc.)
- Suspicious files such as shell.php, backdoor.php or x7x.php. These are a clear sign of a hack.
- In source code, eval(), base64_decode() and assert() are common ways to hide malicious code
- Theme files (in WordPress), which attackers often modify
If you're not confident doing this, call a developer. Cleaning by hand is delicate work. Deleting one file too many can break the site more than the attack did.
In WordPress, extra steps:
- Install a scanning plugin such as Wordfence or Sucuri
- Change all passwords (WordPress admin, database, FTP)
- Delete old plugins and themes, including inactive ones, because their code is still on the server
- Update WordPress to the latest version
- Update everything else
If you have no clean backup, or would rather not clean the site yourself, emergency website support covers diagnosis and recovery.
Step 6: Change all passwords (10 minutes)
This is the step everyone skips because the site already looks fine. Don't skip it. Without it, the rest of the work can be undone.
What to change:
- WordPress admin password
- Database password
- FTP/SFTP password
- Password of the email connected to the site
- Hosting panel password
- Domain registrar password (and the contact email on the domain)
The attacker probably has at least one of these passwords. New passwords should be:
- At least 16 characters
- A mix of uppercase, lowercase, numbers and symbols
- Not "qwerty123" or another common pattern
- Stored in a password manager (LastPass, 1Password), not in a text file
Step 7: Fix Search Console issues and request a review (days to weeks)
Do this only once the whole site is clean and running. Google asks you to verify the fix first, because a premature request only extends the time the site is flagged (web.dev, Request a review).
- In Google Search Console, open the Security Issues report (under Security & Manual Actions).
- Fix every listed issue on every affected page, not only the sample URLs. Fixing some pages does not earn a partial return to search (Google Search Console Help, Security issues report).
- When all listed issues are fixed on all pages, select Request Review. For spam, explain how you cleaned each category.
- Expect a few days for malware reviews, about a day for phishing, and up to several weeks for spam (web.dev, Request a review).
Be patient. Google reviews take time, and the warning stays until the review is done.
Step 8: Find out how it happened (next day)
After the site is restored, find the cause. Otherwise the same weakness gets used again.
Questions to ask:
- Which plugin or theme was vulnerable?
- Were there old versions of software?
- Were passwords weak?
- Were backups made regularly?
- Were security updates applied regularly?
If it's WordPress, check which plugins were updated recently. Attackers target old plugins that haven't been patched. Plugins are where most new WordPress vulnerabilities are found (see Patchstack's 2026 report: 91% of 11,334 in 2025).
Step 9: Protect the site (this hour, if possible)
Now that the site is clean, make sure this doesn't happen again.
The minimum:
- A security plugin, if you are on WordPress: Wordfence, Sucuri, iThemes Security
- Regular backups: daily, weekly at worst. Stored somewhere other than the site's own server: cloud storage, S3, anything separate.
- Regular updates to plugins, themes and the CMS itself, on a fixed schedule, not whenever you remember.
- Strong passwords for every account, kept in a password manager
- Two-factor authentication for WordPress, FTP and hosting
Don't rely on the host alone. In a Patchstack test covering 18 hosting providers, hosts blocked 25.89% of exploit attempts against known WordPress vulnerabilities (Patchstack, hosting test). The test was run by a WordPress security vendor, so treat the figure as indicative.
If you run something more critical (e-commerce, customer data):
- A Web Application Firewall (WAF), such as Cloudflare, Sucuri or Wordfence
- A security audit once a year
- An SSL certificate (HTTPS), always
- Dependency updates, if the site is custom-built
Regular backups, updates and monitoring are what website maintenance covers. Without that routine, most of this list stays on paper.
Notifying customers and the regulator
If customers were affected, for example by phishing sent through your site or exposed form data, tell them.
If personal data was involved, check whether you must notify your data protection authority. Under GDPR, the controller notifies the authority without undue delay and, where feasible, within 72 hours of becoming aware of the breach, unless the breach is unlikely to risk people's rights and freedoms.
Where feasible, not later than 72 hours after having become aware of it. GDPR, Article 33(1), gdpr-info.eu
My experience-based advice
Assume a hack will happen at some point, and prepare for it now.
- Keep a regular backup, off-site. Not on the same server as the site. If the server fails, the backup fails with it.
- Update everything: plugins, themes, the operating system, libraries. Don't skip updates because "the site might change". Updates contain security patches.
- Use strong passwords, and don't reuse them across services.
- If your site handles money (payments, card data), treat security as a budget line, not an afterthought. Put a firewall in front of it and schedule audits.
- If you're on WordPress, its popularity cuts both ways. It is attacked more, but it is also patched quickly and well documented. Use the second part to your advantage.
If you need help right now
If you're reading this mid-incident, here's what urgent help looks like. I work remotely with clients across Poland and internationally, in Polish and English. Write or call and I'll help get the site back up.
A compromise is an incident that can be fixed, and it usually points to one clear conclusion: the site needed looking after sooner.
If you're reading this calmly and your site is working fine, now is the best time to check your backups and updates. That is the point of doing it before rather than after.
Frequently asked questions
How long does it take to clean a hacked website?
Step 5 budgets 1-4 hours for restoring a clean backup or cleaning manually. Manual cleaning of a complex site, or a site with several infected areas, takes longer. Google's review comes after the cleanup and adds a few days for malware, or several weeks for spam.
Will Google blacklist my site?
Google can show a warning in search results and in Chrome while the site is flagged. The flag stays until you fix every listed issue and Google reviews the site. Requesting a review before the cleanup is finished only extends the time the site stays flagged.
Should I pay the attacker?
No. Paying does not remove the malicious code or the backdoor, and the attacker can return. Follow steps 2 to 6 instead, and involve your developer or hosting provider.
Can I just restore a backup?
Yes, if the backup is from before the infection and you can confirm it is clean. First save a copy of the hacked state (step 4) and find the entry point (step 8). If you skip that, the same weakness can be used again after the restore.
How do I request a Google review?
After cleaning, open the Security Issues report in Google Search Console. Fix every listed issue on all affected pages, then select Request Review. For spam, describe how you cleaned each category of spam.