Do not restore anything until three things are true: the machine or network you are restoring onto is clean, the attacker no longer has a way in, and the restore point you have chosen predates the intrusion and has been scanned. Restore into a separate clean area, most important systems first, and test each batch before widening. If you cannot establish those three points yourself, bring in an assured incident response provider rather than guess.
Why a restore can bring the problem straight back
Encryption is often the last thing an attacker does, not the first. Before it, they can spend days or weeks inside the network. Microsoft's ransomware guidance notes that some attacks stage their work over weeks or months, and that slow encryption can leave recent backups holding data that is already encrypted. The newest restore point is therefore not automatically the best one.
Backups are a target too. A Sophos-commissioned survey of 2,974 IT professionals whose organisations had been hit by ransomware, run in early 2024, found that 94% said attackers tried to compromise their backups and that 57% of those attempts succeeded. That sample is made up of organisations that were already victims, so it is not the odds for every business. It is still a good reason to treat your backups as unverified until you have looked.
A restore tends to go wrong in one of three ways. The backup may contain the attacker's tools or persistence, meaning a way back in that survives a reboot or a restore. The device or network you restore onto may still be infected. Or the attacker may still hold working passwords and simply do it again. The checks below take those three in turn.
Before you touch anything: evidence, help and who does what
Isolate affected machines from the network but leave them powered on, and do not wipe anything yet. Microsoft advises preserving compromised systems for analysis, and CISA says to take a system image and memory capture of a sample of affected devices so volatile evidence is not lost. If you find accounts that the attacker seems to have created, disable them rather than delete them if forensic work is planned.
Some of what follows any capable administrator can do. Judging whether the attacker has really been evicted is a different job. The NCSC says investigators should tell whoever is running the response when the risk is low enough for recovery to proceed, and recommends assured incident response providers unless you have an experienced in-house team. Some insurers require an independent team, so check your policy before engaging anyone. The NCSC lists assured providers under its Cyber Incident Response scheme and takes incident reports at report.ncsc.gov.uk.
- Anyone with access to the backup system can list restore points, keep backup drives offline and scan an isolated copy.
- A domain or Microsoft 365 administrator can reset credentials, review sign-in logs and rebuild servers.
- Deciding how the attacker got in and whether they still have access usually needs an incident response provider or a very experienced in-house team.
Choose a restore point you have reason to trust
The aim here is to pick the newest backup that predates the intrusion, then prove to yourself that it is not carrying anything nasty. Do all of this on a separate machine that is known to be clean, not on anything the attacker has touched.
- Keep backup drives, appliances and management consoles off the production network. The NCSC says backups should only be connected to known clean devices before recovery starts.
- List every restore point with its date and what it covers, and note what is missing. Backups often do not capture applications, identity systems or the configuration around them, as the NCSC points out, so some things may need rebuilding from installation media.
- Find the earliest sign of the intrusion, not the date files were encrypted. Look for the first unfamiliar sign-in, accounts or scheduled tasks you did not create, software set to start automatically that you do not recognise, security tools switched off and missing patches that could have been the way in. Then choose restore points from comfortably before that date. If you cannot pin the date down, go earlier than feels necessary and accept that recent data will need recreating from other sources.
- Restore or mount the candidate restore point into an isolated holding area on a clean machine that cannot reach the production network, then scan it with up-to-date antivirus or endpoint protection. The NCSC and Microsoft both say to scan backups before you restore them. Open a spread of files as well, to confirm they are readable and not already encrypted.
- Treat a clean scan as a good sign rather than proof. A scanner only finds what it recognises, which is why the timeline in the third step carries more weight than the scan. If a candidate fails either check, move to the next older restore point and repeat.
Make sure the place you restore onto is clean
Putting good data onto an infected machine just feeds the infection. Servers, and any device the attacker had hands-on access to, are better rebuilt from known-good installation media or standard images than cleaned in place. CISA's checklist advises rebuilding from pre-configured standard images in order of the services that matter most. That is the safest default, and if you are in doubt about a machine, rebuild it.
For ordinary Windows PCs that only need a data restore, or while you work out which machines need rebuilding, a Microsoft Defender Offline scan is a sensible extra check. It restarts the PC into a trusted environment outside the normal Windows session, so it can find rootkits (malware that hides itself from the running operating system) that an ordinary scan can miss. Microsoft specifically suggests it for confirming a thorough clean after an outbreak. Scan any device that syncs data with the affected systems and the targets of mapped network drives too.
The offline scan needs Windows 10 or 11 on x64 hardware, with Microsoft Defender Antivirus as the main antivirus, a signed-in local administrator and Windows Recovery Environment (WinRE) switched on. It does not apply to ARM devices or Windows Server editions, which is one more reason servers get rebuilt.
- On the isolated device, open PowerShell as an administrator and check that Defender is the active antivirus and its definitions are recent. This command only reads settings. AMRunningMode should show Normal rather than Passive, and AntivirusSignatureLastUpdated should be recent. A device cut off from the internet will not update itself, so copy the latest manual definition update across from a clean machine if you need to.
Get-MpComputerStatus | Select-Object AMRunningMode, AntivirusSignatureLastUpdated - Check that WinRE is enabled. If the status shows Disabled, the offline scan silently does nothing and gives no error, so enable it with the second command. That changes the recovery configuration on this device only.
reagentc /inforeagentc /enable - If BitLocker encrypts the system drive, suspend its protection first using Microsoft's instructions for suspending BitLocker, and have the recovery key to hand. Otherwise the restart into the offline environment may prompt for it.
- Save and close anything open, then start the scan from Windows Security: Virus and threat protection, then Scan options, then Microsoft Defender Offline scan, then Scan now. Alternatively run the PowerShell cmdlet below, which restarts the device to begin the scan. Windows asks you to save your work and for permission, signs you out within a minute and restarts into the scan. Microsoft puts it at about 15 minutes, after which the machine restarts into Windows by itself. Stay nearby in case a prompt appears.
Start-MpWDOScan - Back in Windows, open Windows Security, go to Virus and threat protection and under Current threats select Scan options, then Protection history. If anything was detected, treat the device as compromised and rebuild it rather than trusting a clean-up. Even with no detections we would still rebuild any machine the attacker had administrator access to.
Restore in stages, into a clean area
Recovery is where a second infection usually gets its chance, because people are tired and in a hurry and the network is full of half-trusted machines. Go slowly enough to see problems while they are still small. The NCSC makes the same trade-off explicit: restoring can take considerable time, and you balance pace against the level of assurance you need.
- Set up a recovery network: a separate VLAN (a logically isolated section of your network) or physically separate switch ports. Admit only systems you have rebuilt or verified. CISA gives exactly this example, adding only clean systems to a new recovery VLAN.
- Restore in order of dependency. Shared services such as identity come first because nothing else works without them, then the systems that keep money coming in, then everything else. If you are on Microsoft 365 with cloud-only identity, that first step may be a review of accounts rather than a server restore.
- Reset credentials before users reconnect. CISA says to issue password resets once the environment has been cleaned and rebuilt, and Microsoft says to reset known-compromised accounts and consider privileged accounts such as Domain Admins. In our judgement, anything the attacker could have read, including service accounts and the backup system's own credentials, should be treated as known to them. Agree the sequence with your responders so you do not alert an attacker who is still present.
- Restore one small set first, such as a single file share or application, and test it before the next. Open files, check that endpoint protection raises no detections, and look for unfamiliar sign-ins, new accounts, new scheduled tasks, unexpected outbound connections and any fresh ransom notes or newly encrypted files. Keep protection running and logging throughout. Microsoft recommends collecting telemetry as you restore so you can tell whether malware is still present.
- Widen in steps. Reconnect users and further systems only after the previous batch has stayed quiet.
If your files live in OneDrive or SharePoint
Microsoft's advice for OneDrive is to clean every device that syncs first, because restored files can be encrypted again if an infected device is still connected. Pause OneDrive sync on suspect devices so they cannot update your cloud copies, and confirm there has been no unauthorised access in your Microsoft 365 tenant before restoring.
In OneDrive for Business, Files Restore can roll an entire OneDrive back to an earlier point in time within the last 30 days. Choose a time before the first sign of trouble, as above. Hold off on letting users restore their own files until you are confident the attacker has been evicted, because Microsoft warns they could put the malware back.
If none of the restore points can be trusted
Sometimes every restore point is either too close to the intrusion or has failed a scan. The NCSC's advice is to identify alternative sources from which critical data can be reconstructed and to plan how that workaround data will be reconciled afterwards. In a small business that might mean accounting data held with a cloud supplier, copies in email, customer and supplier records or paper. How much data loss the business can tolerate is a decision for the owners, not an IT setting. This is also the point to ask an incident response provider for help rather than push on with a restore you cannot defend.
How you know the restore has held
You are not finished when the last file copies across. Over the period you are watching the restored systems, you want to see all of the following:
- No antivirus or endpoint protection detections on restored systems or the devices that connect to them.
- No new ransom notes and no newly encrypted files appearing.
- No sign-ins, accounts or scheduled tasks you cannot explain.
- Whoever is leading the investigation, whether in-house or a provider, is satisfied that the attacker's access has been closed.
Technical terms explained
- BitLocker
- Windows drive encryption. If its protection is not suspended before certain changes, the PC can ask for a recovery key at the next start-up.
- persistence
- A method an attacker sets up to keep access after a reboot or a clean-up, such as a new account, a scheduled task or a hidden remote access tool.
- rootkits
- Malware designed to hide itself from the running operating system, which makes it harder for an ordinary scan to find.
- VLAN
- A virtual LAN: a logically separate section of a network, so that devices on it cannot talk to the rest of the network unless you allow it.
- Windows Recovery Environment
- A small, separate recovery system built into Windows. Microsoft Defender Offline uses it to run a scan outside the normal Windows session.
Sources and further reading
- Mitigating malware and ransomware attacks - NCSC
- Recovery and ongoing investigations - NCSC disruptive cyber attacks guidance
- Ransomware attack - NCSC respond and recover
- #StopRansomware Guide: Ransomware and Data Extortion Response Checklist - CISA
- Responding to ransomware attacks - Microsoft Defender XDR playbook
- Microsoft Defender Offline scan in Windows - Microsoft Learn
- Azure backup and restore plan to protect against ransomware - Microsoft Learn
- The impact of compromised backups on ransomware outcomes - Sophos