By now, ransomware is an unfortunate fact of life. Anyone who’s been working in IT for some time has very likely brushed up against it at some point during their career–and while it’s a stunning encounter in the outset, it’s the response to that encounter that makes all the difference.
Before we go any further, I want to make this very clear: if your data is important to you, it is very wise not to attempt recovery/response on your own. Bring your machine to a professional instead! If you have nothing to lose, however, below are some guidelines to follow to attempt recovery in the aftermath of an attack.
It’s useful to comprehend the steps most ransomware specimens take to attacking/encrypting data on a machine to help facilitate a response to their attacks. This is absolutely not meant to be a comprehensive article on the subject (far more detailed analyses have been written by experts such as Lawrence Abrams at his excellent BleepingComputer.com), but here are a few common points that apply to most every ransomware in the wild today:
- Most of them limit the types of files they encrypt to those which are most likely to contain critical user data–stuff like photos/pictures, documents, videos, databases, etc.
- System/program/non-user data directories (X:\Windows, Program Files, Program Data, %APPDATA%, etc.) are explicitly excluded from encryption to prevent system stability issues post-infection and improve efficiency
- Encryption normally begins silently in the early morning hours while the user is less likely to be in front of the machine.
The above items are done in the interest of efficiency to ensure the ransomware is able to complete its encryption job without the user noticing. Typically, after the completion of the encryption, the ransomware will then remove itself from the system–leaving only a ransom note with payment instructions, as that’s all the attackers care about at this point after all.
Although most of them apply the same strategy (and many are, in fact, even blood-related), the first step to properly responding to a ransomware attack is to take a sample and attempt a positive ID of the malware. This can be accomplished by using services such as ID Ransomware (by MalwareHunterTeam/Demonslay335), which is a free online resource that attempts to identify a ransomware infection based on either a ransom note or sample encrypted file. However, it’s very important that you do not obtain the file while running on the infected OS. Doing so provides the ransomware precious additional time to complete its destruction of the existing data if it has not already completed. If you must collect the file in the host infected OS, only do so after you obtain a forensic image of the data.
Once an ID has (hopefully) been completed, the next step is to respond and attempt recovery (if necessary/desired)–assuming no backups are present and that does not exist as a (much simpler) option. This involves several steps, but it roughly goes something like this:
- Obtain a forensic image of all affected storage devices/machines and store it safely away from the machine.
- Boot to a portable environment and manually inspect the parameters of the system, including:
- Boot processes, services, tasks, and other items frequently leveraged by malware as loading points
- The locations of any files which are infected, malware, or related to the ransomware infection
- The System Volume Information repository contents and the Volume Shadow Copy parameters/settings (to ensure that Shadow Copies and System Restore are turned on and that sufficient space is configured to allow for the storage of Shadow Copies)
- The health of any affected storage devices
- If necessary, suspend/disable any components which are related to the malware/ransomware infection next.
- Once this is completed, reboot into the host OS (Safe Mode if possible) and, if a decrypter has been identified for your particular ransomware infection, obtain it and attempt decryption of the data.
- If a decrypter has not been identified, the only remaining solution is usually to attempt to dig into the Volume Shadow Copy Storage in hopes of previous versions of the affected data still being present.
- Ransomware specimens often attempt to purge shadow copies of files post-encryption to prevent recovery of the files using shadow copy storage. However, the methods used to do this are often heavy and time-consuming (typically it’s a vssadmin command that’s used to accomplish this). Many times the process will not have completely finished by the time the user notices the damage. That’s why sometimes digging into the VSS storage can be a successful solution to recovering data following a ransomware attack.
- There are multiple tools available which can accomplish Shadow Copy file restoration, but the best is probably ShadowExplorer.
- If shadow copies do not exist, the last-ditch effort to retrieve some remaining data is typically to perform a file carving operation on the entire hard drive. Tools such as PhotoRec can be used to accomplish this. File Carving identifies files based on their headers and not based on filesystem information/structural data (MFT/FAT/etc). As a result, it can sometimes turn up lost files even following a ransomware attack.
- Most ransomware specimens wipe both free space and the sectors on the disk affiliated with previous/clean versions of encrypted files once encryption is complete, so this process is usually fruitless. But, as a last resort, it’s worth a shot.
If all else fails, backups are the final option. If no backups exist, the user must consider paying the ransom in hopes of recovering their data–though authorities and experts will invariably tell you not to do this, as it encourages ransomware as a viable business venture and, therefore, the attackers win. However, most ransomware gangs will in fact restore data following successful receipt of payment–and sometimes it is the only option.
Once recovery has (hopefully) been completed, any remaining ransom notes can be automatically removed using Demonslay335’s RansomNoteCleaner tool here.
For specific help on a ransomware infection, check out BleepingComputer’s free support forum here. Remember, though–if your data is important to you, let an expert handle it! Don’t attempt a DIY recovery!