After a website is attacked, it is necessary to restore the backup, should the vulnerability be patched first or the data be restored first?
After a website is hacked, should you patch the vulnerability first or restore the backup data? The order is to patch the vulnerability first and then restore the data. In the case of large-scale exploitation activities of content management systems, the official recommendations are very clear: first, patch all affected platforms and extensions, and then restore the site from a known good backup. The reason is very direct - if you write the copy back when the entrance is still open, the attacker will come in again through the same path, and the restoration action itself will bring the time point with the backdoor back online.
If the order is wrong, you will be hit repeatedly.
A common phenomenon is that the file is written again with the same abnormal script a few days after it is cleared. This kind of repetition is usually not due to incomplete cleaning, but rather the entry is not closed: some extension has not been upgraded to the fixed version, some account password is still in the attacker's hands, or the temporary debugging interface is still open. Prioritizing patching over recovery is to make the restoration a one-time action, rather than the first step in a loop.
The first step is to cut off the entry
Execute in a verifiable order: first, switch the site to read-only or maintenance mode, limit the access source of the background and interface; then confirm the list of affected programs and extensions, and upgrade each to the fixed version; subsequently, rotate the login credentials and administrator passwords, including the reused old passwords. This step produces a change record, indicating which components were added and which accounts were changed, to facilitate later judgment of which backup is clean.
Why verify on a clean copy?
Backup should be selected at a time point before any suspicious modifications, and with a reason. The criteria for availability are three: there were no abnormal files at that time point, no additional administrator accounts, and the task list is consistent with the site description. If unsure, first restore to an isolated environment and run it, check that the pages, forms, and interfaces can work normally before going online, and avoid bringing back the modified templates and scripts.
Points to note when restoring from a backup
The range of recovery is not limited to the database: uploaded files, templates, and generated static products may also contain abnormal content. After recovery, three checks should be made - whether the account and permission groups have been changed, whether the content status is abnormal, and whether there are any residual test scripts or redirects within the site. The status of the documents should also be checked together: drafts, pending release, and content in the recycling bin may be used to hide things, deleted documents can still be recovered in the recycling bin, and these contents should be checked together when disposed of.
Strengthening after recovery
Make a one-time action a routine: backup tasks should be run regularly and recovery drills should be conducted, sensitive word filtering and content review ensure the outlet of the release side, use JWT and other credentials for login and interface side and add human verification to the form, keep interference codes and other anti-crawling measures within the site. The attack surface mostly does not come from sophisticated techniques, but from components that have not been upgraded for a long time and permissions that no one has reviewed.
Common questions
Can you recover first and then supplement it to reduce downtime?It is not recommended, recovery when the entry is not closed is equal to repeated victimization, the downtime window should be compressed from read-only and maintenance mode.
What should be done if there is no可信 time point?First, do the cleaning at the file and account level and close the entry, then observe a period of time and confirm that there is no rollback before rebuilding the baseline backup.
Should the contents in the recycle bin be managed?Yes, deletion only moves it to the recycle bin and is not a physical deletion. This part should be included in the inspection range during recovery and cleanup.
How often should a recovery drill be done?The common rhythm is to check the availability of backups monthly and to conduct a full recovery exercise quarterly.