You have been told your site distributes malware, or you found unknown code in your files. Panic leads to mistakes such as deleting evidence or cleaning once and missing the way back in. Use this order.
Minutes 0 to 10: contain
- Put the site in maintenance mode, or restrict access, if it is actively harming visitors.
- Change the hosting panel, FTP or SFTP, database and site admin passwords from a clean computer.
- Remove unknown users and active sessions.
Minutes 10 to 25: preserve
- Download a copy of the files and the database as they are now.
- Download the access and error logs. They show the first request that did not belong.
Minutes 25 to 45: find
- List files changed in the last days. Unexpected changes to index.php, .htaccess, wp-config.php and theme files are common.
- Look for PHP files in upload and cache folders, and for very long lines of encoded text.
- Check cron jobs and the database for injected scripts in posts and options.
Minutes 45 to 60: clean
- Restore from a backup taken before the infection if you have one, then apply all updates before going live.
- Otherwise replace core files with fresh copies, reinstall plugins and themes from official sources and remove everything unused.
After the first hour
- Find and fix the entry point, or the site will be hit again.
- Ask Google and other warning services to review the site once it is clean.
- Scan the computers that had access to the site.
- Add backups kept away from the server, login protection and monitoring for file changes.
Common questions
Should I take the site offline during the first hour?
If the site is spreading malware or collecting data from visitors, yes, put up a simple maintenance page. A short, planned outage is better than harming your visitors and your reputation.
Why keep a copy of the infected files?
The copy shows what was changed and when, which helps you find the entry point. Store it safely away from the live site and do not open the files on a work computer.
Is restoring a backup enough?
Only if the backup is from before the infection and you also fix the way in. Otherwise the attacker returns through the same hole.
How do I check that the site is clean?
Compare files with a fresh copy of WordPress and your plugins, scan again after cleanup, and watch the logs for new unknown files over the following days.
When to ask for help and what to send
If you cannot find the entry point, ask for help early. Send the time you noticed the problem, the warning you saw, the list of recent changes, and the infected copy you saved. Support can check server logs and access records that you cannot see from the application.
A realistic example
A site owner sees a warning in the browser that the site contains harmful content. In the first ten minutes she puts up a maintenance page, changes the passwords and saves a copy of the files. In the next hour a review finds a file added by a vulnerable plugin. Because she kept the copy, the cause is clear, and the cleanup holds. Speed matters, but order matters more.
Mistakes to avoid
- Cleaning before saving a copy.
- Restoring an old backup without finding the entry point.
- Leaving the site live while visitors are at risk.
Quick checklist
- Maintenance page up, if visitors are at risk.
- Change hosting, FTP, database and admin passwords.
- Save a copy of the infected state.
- Find and remove modified files and unknown users.
- Update software and watch the site for a week.
If you would like a second pair of eyes, send the logs to support@mubasher.com.eg.
