Guides · Website security
How to respond when your website is hacked
Discovering your website is hacked — defaced, redirecting, flagged by browsers, or quietly hosting someone else's pages — starts a clock where the first day's decisions decide whether it becomes a bad week or a business-ending event. This guide is the first 24 hours, in order: contain, preserve, understand, clean, restore trust. It assumes no security team, just an owner, a developer or host, and the need to act in the right sequence.
By the Ingenious AI team · Published 14 November 2026 · Reviewed 19 November 2026
The short answer
In the first hour: take the site offline or put up a holding page if it is harming visitors, preserve evidence (host logs, file timestamps, screenshots, the malicious files themselves — do not delete first and investigate later), and change the passwords that control the kingdom (hosting, registrar, CMS admin) from a clean device. Then scope the breach with your host's help, clean or restore from a known-good backup, rotate every credential the site ever touched, and only then bring the site back — followed by browser-blocklist removal requests, a post-mortem, and honest communication with any customers whose data was involved.
Try it free: BreachHunter — run a free external assessment to map what an attacker can still see — the exposure picture your recovery must close.
What is a website incident response?
the emergency process for a compromised website: containment of harm to visitors, preservation of forensic evidence, eradication of the attacker's access and code, recovery from a trustworthy state, and restoration of the trust (search, browser and customer) that a compromise spends. It differs from ordinary troubleshooting in one respect: an adversary is present, so every step assumes they may be watching, returning, or both.
Hour 1: Contain and preserve
If the site is serving malware, phishing or redirects, take it down to a static holding page — every hour it harms visitors costs more trust than an hour of downtime. Contact your host immediately; good hosts do this weekly and bring tooling and calm. Before cleaning anything, preserve evidence: export access and error logs, note file modification times, screenshot the visible compromise, and copy suspicious files aside (zipped, untouched). Change the master passwords — hosting account, registrar, DNS, CMS super-admin — from a device you trust, with MFA enabled as you go. The attacker's most common asset is a credential; assume all of yours are known until rotated.
Hours 2–6: Scope what happened
Work out the entry point and the reach: How did they get in (vulnerable plugin, stolen password, exposed file)? What did they change (files, database, users, DNS)? What could they have taken (customer data, order history, email lists)? Did they leave backdoors — the classic second act is a hidden admin user or a webshell file that survives a superficial cleanup. Your host's malware scan plus a review of users, scheduled tasks and recently modified files forms the scope. Write it down as you go; insurers, processors and (if personal data is involved) regulators will ask questions that only this record answers.
Clean or restore — from a state you can prove
Two honest paths: restore from a backup that predates the compromise (you must be able to argue why that backup is clean — ideally it predates the earliest suspicious log line), or clean the live site file by file and record by record. Restoring is usually faster and more certain for small sites; cleaning is necessary when the backup is too old or also compromised. Either way, patch the entry point before the site returns — restoring a vulnerable site is scheduling the sequel. And clean wider than the visible damage: the files you can see are rarely the whole infection, because persistence hides in places a quick cleanup never opens — a plugin folder that restores its siblings, a database row, a scheduled task, a hidden admin account. Deleting only what is visible is how sites get 'cleaned' three times in a month. Update everything, remove the unused plugins and files that formed the attack surface, and re-scan externally before relaunch.
Rotate everything, everywhere the site reached
The credential rotation is broader than the site: CMS users, database passwords, API keys stored in configs (payment, email, analytics, shipping), FTP/SFTP accounts, and any service whose key sat in a file the attacker could read. Check the neighbouring properties too — a shared hosting account or a reused password means the shop next door (also yours) is in scope. Enable MFA everywhere it exists. This step feels excessive exactly until the first 'we cleaned it and it came back' story, which is always a rotation that stopped one credential short.
Relaunch, unblock and communicate
Request review from the browser blocklists (Safe Browsing via Search Console) and any antivirus flags once the site is verifiably clean — relaunching while still flagged teaches customers your address is dangerous. Then communicate: if customer data may have been exposed, tell affected customers specifically and promptly, with what happened, what data, and what you have done — discovering it from a third party is what converts an incident into a reputation. Finish with the post-mortem that produces your new checklist: entry point, detection gap, the monitoring that would have caught it sooner. The hack you document becomes the defence you needed.
Three terms that matter mid-incident
Backdoor (or webshell): a hidden way back in that the attacker leaves behind — a file that accepts commands, an admin account you did not create, a scheduled job that re-creates the infection. Eradication means finding these, not just removing the page that annoyed you. Blocklist: the warning lists browsers and search engines keep — Google Safe Browsing is the one your customers will meet as a red 'deceptive site ahead' screen. Getting off it is a review you request after the site is verifiably clean; asking early, on a hope, gets the review rejected and the process lengthened. Exposure: what an attacker can still see and reach from outside — open ports, exposed files, stale subdomains. Your recovery is done when the exposure picture is closed, which is why the external re-scan is the last step and not an optional one. Two companion guides in this hub cover the warning-list cases in depth: Google blacklist removal and clearing a VirusTotal false positive; if the same compromise keeps returning, start with why a WordPress site keeps getting hacked after cleanup.
Your 5-action checklist
- Contain: holding page if visitors are being harmed; call the host; preserve logs, files and screenshots before cleaning.
- Change hosting, registrar, DNS and CMS master passwords from a clean device, with MFA.
- Scope the breach: entry point, changes, data reach, backdoors (hidden users, webshells, scheduled tasks).
- Restore from a provably clean backup or clean thoroughly — and patch the entry point before relaunch.
- Rotate every credential the site touched, re-scan externally, request blocklist reviews, and notify affected customers specifically.
Worked example: Tidal Ceramics Studio (Returns)
Tidal Ceramics Studio — the fictional pottery shop from our security checklist — found its hack through a customer: the site redirected mobile visitors to a lottery scam while looking normal on the owner's desktop. Hour one followed this guide: holding page up, host engaged, logs preserved — which mattered, because the logs showed the entry was an outdated plugin and the first malicious file landed 11 days earlier. That date chose the backup (12 days old, clean) and defined the customer-data window (orders in those 11 days were reviewed; the payment data itself lived with the processor and was untouched). Every credential rotated, the plugin set cut from 19 to 11, external scan clean, Safe Browsing review passed in 36 hours. Total downtime: about a day. The owner's post-mortem produced the weekly update slot and monthly scan that the checklist guide describes — written, as she puts it, 'in the ink of experience'.
Sources
- NIST — SP 800-61 Rev. 2, Computer Security Incident Handling Guide (2012) — the contain, eradicate, recover order this 24-hour sequence follows.
- Google — Safe Browsing (phishing and malware URL reporting) — the browser warning the FAQ asks about — and the review request that clears it once the site is clean.
Frequently asked questions
Should we pay anyone who offers to 'clean it fast' via an unsolicited message?
No. Compromised sites attract scam 'cleanup' offers, some from the attackers themselves. Work through your host or a firm you find and vet independently. Speed matters, but the cleaner's access is total — choose them like a locksmith during a burglary, not from a note through the door.
How do we know the backup is clean?
Date it against evidence: the earliest suspicious log entry, the oldest malicious file timestamp, the first odd admin action. A backup older than the earliest evidence, whose own files scan clean, is your candidate. If no backup qualifies, clean the live site instead and accept the longer road.
Do we have to tell customers?
If their personal data was or may have been accessed, in most jurisdictions yes — and ethically, regardless. Tell them what data, what you have done, and what they should do (usually: watch statements, be wary of phishing referencing the real order). Specific, early honesty is consistently cheaper than late discovery.
The site is clean but Google still flags us. What now?
Request a review through Search Console's security issues panel once you have verified cleanliness (external scan plus host scan). Reviews typically resolve in days. Meanwhile the flag is doing its job — do not request review on a hope; a rejected review for a still-infected site lengthens the process.
How do we stop it happening again?
The post-mortem names the entry point; fix that class, not just that instance: update rhythm, minimal plugins, MFA and unique accounts, off-server backups, monthly external scans. Most second compromises enter through the same door as the first — lock the door type, not the door.
Related guides and tools
- A lookalike domain is live: your first 24 hours — the impersonation incident, same discipline
- When an AI agent deletes your production database — the agent-side incident
- WordPress site keeps getting hacked after cleanup
- How to choose a website security scanner
- DMARC setup guide for small businesses
- Website security checklist for small businesses
- AI agent security: a buyer's guide
- How much does a website security audit cost?
- DMARC vs SPF vs DKIM: what each one actually does
- How to stop email spoofing of your domain
- AI chatbot security checklist
- All Ingenious AI guides
- The full Ingenious AI platform suite
- The security suite overview
- BreachHunter — free tool