Website Hacked What to Do: 5 Fixes That Work
Fix a compromised site fast. Compare restore, manual clean, and rebuild options. Stop malware spread and secure your hosting account today.

On this page
TL;DR — Key takeaways
- Isolate the site immediately by taking it offline or restricting access to prevent further data exfiltration and malware spread.
- Restore from a known clean backup taken before the compromise date; verify the backup integrity before deploying it to production.
- Change all credentials, including database, FTP, SSH, and panel access, using unique passwords stored in a manager.
- Scan the restored files with a reputable security tool to ensure no residual backdoors remain in the codebase.
- Patch all core software, themes, and plugins to their latest versions before bringing the site back online.
Your site is down, or worse, it's serving malicious code. Panic is normal, but it slows you down. The first move is always isolation.
This guide compares three recovery paths: restoring from backup, manual cleaning, and a full rebuild. Each has trade-offs in time, cost, and risk. Pick the one that fits your situation.
Immediate Triage: Stop the Bleeding
Before you touch a single file, stop the active threat. If the site is live, malware is likely spreading or exfiltrating data. Take it offline immediately. Use your hosting panel to enable maintenance mode or point the domain to a static 'Under Maintenance' page.
In support tickets I handled, the usual culprit was a full disk or a compromised admin account. Check your server logs first. Look for unusual login attempts, failed SSH connections, or unexpected file writes. Note the timestamps. This helps you identify when the breach started.
Do not delete files yet. You need evidence for forensic analysis. If you use a managed host, contact their security team now. They can isolate the server and preserve logs.
- Enable maintenance mode or take the site offline
- Check access logs for unauthorized IP addresses
- Note the first suspicious activity timestamp
- Contact your hosting provider's security team
Option 1: Restore from Backup
This is the fastest path if you have a clean backup. The key word is 'clean'. A backup taken after the compromise is useless. You need a snapshot from before the first suspicious activity you found in the logs.
Restore the files and the database separately. Verify the database integrity by checking for injected SQL or unexpected admin users. Then, restore the file system. Overwrite the current compromised files with the backup version.
The trade-off here is data loss. Any content created between the last clean backup and the compromise is gone. If you have daily backups, this loss is minimal. If you only have weekly backups, you might lose a week of work.
- Identify the last known clean backup date
- Restore database first, then files
- Verify no malicious entries in the database
- Accept potential data loss for recent content
Option 2: Manual Malware Removal
Use this if you don't have a clean backup or if the compromise is recent and limited. It's slower and riskier. You're hunting for hidden files and modified code.
Start with a reputable security scanner. Upload the plugin or use a CLI tool to scan the file system. Look for obfuscated code, base64 strings, and unexpected .php files in image directories. Check file permissions too. Executable permissions on non-executable files are a red flag.
Remove the malicious code. If a file is heavily compromised, delete it and restore it from a clean source if possible. If you can't identify the source, delete the file and monitor for its return. This indicates an active backdoor.
- Run a full malware scan on the file system
- Look for obfuscated code and suspicious file extensions
- Check file permissions for anomalies
- Delete compromised files and restore from clean sources
Option 3: Full Rebuild
This is the nuclear option. Use it if the compromise is deep, the backup is corrupted, or you suspect the core software is tainted. It's the most time-consuming but the safest.
Set up a fresh environment. Install the latest version of your CMS, themes, and plugins. Import your content from a clean database export. Do not copy any files from the compromised server. Re-upload media files from your local source or a clean backup.
The trade-off is time and effort. You're rebuilding from scratch. But you get a clean slate. No hidden backdoors, no residual malware. It's the best option for long-term security.
- Set up a fresh CMS installation
- Import content from a clean database export
- Re-upload media files from local sources
- Do not copy any files from the compromised server
Post-Recovery: Secure and Monitor
Restoring the site isn't enough. You must secure it to prevent re-infection. Change all credentials. Admin, database, FTP, SSH, and panel access. Use unique, strong passwords. Store them in a password manager.
Update everything. Core software, themes, and plugins. Outdated software is the #1 entry point for attackers. Enable two-factor authentication for all admin accounts. Restrict file permissions. Web server should only need read access to most files.
Monitor your logs for 48-72 hours. Look for unusual activity, failed login attempts, or unexpected file changes. Set up alerts for critical security events. If you see suspicious activity, isolate the site again and start the process over.
- Change all credentials with unique, strong passwords
- Update core software, themes, and plugins
- Enable two-factor authentication for admin accounts
- Monitor logs for 48-72 hours for unusual activity
Quick troubleshooting checklist
- Take the site offline or put it in maintenance mode
- Identify the compromise date via logs or file timestamps
- Restore files and database from a pre-compromise backup
- Rotate all credentials (admin, DB, FTP, SSH)
- Run a full malware scan on the restored environment
- Update core software, themes, and plugins
- Review user accounts for unauthorized additions
- Monitor logs for 48-72 hours after relaunch
FAQ
How long does it take to fix a hacked website?
Simple malware removal takes 1-4 hours. Full recovery with credential rotation and patching takes 4-24 hours. Complex breaches requiring forensic analysis can take several days.
Should I delete all files and start over?
Only if the backup is corrupted or the compromise is deep in the core files. Otherwise, restoring from a clean backup is faster and preserves your content and SEO equity.
Will my site be penalized by Google after a hack?
Yes, Google may flag your site as 'Hacked' in Search Console. You must submit a review request after cleaning the site to remove the warning and restore rankings.
Related articles
- Hosting OperationsWebsite Hacked What to Do: 7 Fixes That WorkFix a compromised site fast. Compare manual cleanup vs. rebuild strategies, identify root causes, and secure your hosting environment effectively.
- Hosting OperationsWordPress Malware Removal: 5 Fixes That WorkFix WordPress malware removal issues fast. Compare 5 methods, identify root causes, and secure your site with practical steps.
- Hosting OperationsWebsite Hacked What to Do Fix: 7 Methods Compared (2026)Compare seven proven methods to fix a hacked website: manual cleanup vs security plugins vs professional recovery. Pick the right approach for your situation.
- Hosting OperationsHow to fix website hacked what to do troubleshoot: Comparison and Best PracticesCompare incident response approaches for hacked websites. Learn immediate containment steps, cleanup methods, and long-term hardening strategies.
- Hosting OperationsWebsite Down Not Working: 7 Fixes That Actually WorkFix a website down not working error fast. Check DNS, server status, and code errors with these 7 practical steps for hosting owners.
- Hosting OperationsWebsite Down? 7 Security Fixes That Actually WorkStop recurring website down errors by hardening your server. Fix DNS, SSL, and firewall misconfigurations with these 7 verified steps.