Synology NAS Encrypted by Ransomware: Data Recovery and First Steps

Ransomware Reverse Editorial TeamLast technical review:

In short

When a Synology NAS has been encrypted, one question largely determines the recovery path: were only the shared folders encrypted from an infected client, or did the attackers have administrator rights in DSM? In the first case, Btrfs snapshots, the recycle bin and Hyper Backup versions are often still intact and can be restored as a copy. In the second case, recovery starts from images of every drive: SHR or mdadm, LVM and older Btrfs structures. Image the drives before any repair, reset or reinstall.

Synology encrypted: the first minutes

Files on your shared folders suddenly carry an unfamiliar extension, there is a ransom note in every folder, or DSM shows accounts and processes you don't recognise? Right now the priority is not to make things worse.

  • Disconnect it from the network. Pull the cable, disable port forwarding on the router, block QuickConnect and VPN access.
  • Don't repair, don't reset, don't reinstall.
  • Take screenshots: Storage Manager, the snapshot list, shared folders, User & Group, Log Center.
  • Copy the ransom note and two or three encrypted sample files to a separate drive.
  • Record the model, DSM version, drive order and bay assignment, and photograph them.
  • Find out whether Windows servers, clients or backup systems are affected too.

Powering off versus leaving it running is a trade-off. During the SynoLocker outbreak in 2014, Synology advised shutting the device down immediately to stop further encryption.[1] Shutting down, however, also wipes volatile traces such as running processes and connections. If encryption is visibly still in progress, stopping it comes first. If it has finished, isolating the network is usually enough until specialists decide on next steps.

General emergency measures are on the ransomware emergency page. This page covers the questions specific to Synology. For a cross-vendor overview, see NAS data recovery after ransomware.

How ransomware gets onto a Synology NAS

For data recovery, the attack path is not a side issue. It determines whether the snapshots and backups on the device can still be trusted.

Encryption through SMB shares from a client

A common scenario in businesses: a Windows client or server is infected, and the ransomware encrypts everything it can write to through mapped drives and SMB shares. DSM itself is not compromised. Volumes, storage pool and the Btrfs file system remain structurally intact. A regular share account cannot touch snapshots, because Synology documents that users have no write permission on snapshot copies.[8] This scenario offers the best chances.

Brute force against DSM accounts

In July 2019, Synology warned of a ransomware wave in which administrator passwords were guessed through dictionary attacks rather than exploited vulnerabilities.[2] In August 2021 it reported further brute-force attacks from a botnet attributed primarily to the StealthWorker malware. After a successful login, a payload could be installed that, according to Synology, might include ransomware. Synology saw no evidence of a software vulnerability being exploited.[3] What both waves had in common: DSM or other services were reachable from the internet, and the attackers operated with administrator rights.

eCh0raix for Synology

The eCh0raix family reportedly hit Synology devices as early as 2019 using guessed admin credentials.[5] In August 2021, Unit 42 described a variant that targets QNAP and Synology NAS alike. In Synology mode it encrypts the paths /volume0 to /volume9, appends .encrypt and drops a note named README_FOR_DECRYPT.txtt (with a double "t").[4] The AES key comes from the attackers' server.[4] Against QNAP devices the same variant also exploited a vulnerability; see QNAP NAS after ransomware.

SynoLocker (2014)

In 2014, SynoLocker exploited a vulnerability that Synology had already fixed in December 2013. Older DSM versions up to 4.3-3810 were affected. Synology stated that it could not decrypt files that had already been encrypted.[1] For today's incidents, SynoLocker is mainly a lesson: unpatched, reachable legacy devices remain a target.

Attackers with admin rights

Once attackers hold an administrator account, the picture changes. They can delete snapshots and snapshot schedules, empty recycle bins, remove Hyper Backup tasks and local backup targets, and encrypt shared folders directly on the NAS. Such access comes from guessed DSM passwords, but also from credentials harvested inside the corporate network, for example from password stores on admin workstations.

Under the hood: SHR, LVM, Btrfs and ext4

Recovering a Synology NAS means understanding its layers. From the bottom up:

  1. Linux software RAID (mdadm): According to Synology, Synology Hybrid RAID (SHR) is based on the Linux RAID management system. SHR divides drives of different sizes into chunks and builds several redundant arrays from them.[6] Classic RAID types (RAID 1, 5, 6, 10) also use mdadm.
  2. LVM: With SHR, and with pools holding multiple volumes, an LVM layer sits on top. Synology's own guide to reading data on a PC shows volume groups such as vg1000 or vg1 with logical volumes such as volume_1, and md arrays with version 1.2 superblocks.[7]
  3. File system: Btrfs or ext4. This choice is decisive for ransomware recovery.

Btrfs uses copy-on-write: changed data is written to a new location rather than over the old one. Synology only offers shared folder snapshots on Btrfs volumes.[8] Active Backup for Business also requires Btrfs on the backup destination.[14]

ext4 often writes changes in place. Shared folder snapshots are not available on ext4 volumes.[8] If reconstruction is the only option left, every minute of further writes to the volume counts.

The general differences between ext4, Btrfs, XFS and ZFS in recovery are covered in the guide Ransomware on servers, NAS, RAID and VMware.

What survives ransomware? Snapshots, recycle bin, backups

Synology offers several protective layers. Which of them still helps after an attack almost always comes down to the same point: did the attackers have administrator rights?

FeatureAfter encryption via SMB shareAfter a DSM admin compromiseRequirement
Snapshots (Snapshot Replication)usually intact, read-only for users[8]may have been deletedBtrfs volume, active schedule[8]
Immutable snapshotsintactcannot be deleted during the protection period[10]DSM 7.2 or later, supported model[10][11]
Snapshot replication to a second NASintactintact if the target has separate credentialsseparate administration
Recycle bin (#recycle)may hold originals if the ransomware deletes rather than overwrites filesmay have been emptiedenabled per shared folder[12]
Hyper Backup (multi-version, .hbk)intact if the target was not reachable as a shareat risk if the target can be deleted from the NAStarget outside the NAS[13]
Active Backup for Businessintact if storage is separateat risk on the same NASBtrfs destination[14]
WriteOnce shared folderscannot be changed within the retention periodcannot be changed within the retention periodDSM 7.2 or later[11]

Three details that are often overlooked in practice:

  • Recycle bin and snapshots are linked. Synology documents that recycle bin contents are recorded in snapshots.[23] With the recycle bin disabled, deleted files are removed permanently straight away.[12]
  • Encrypted shared folders have limits. Snapshots of encrypted shared folders cannot be browsed, and Restore to this snapshot is not available for mounted encrypted shared folders.[8][9] Without the folder's key file or password, you won't get any further.
  • Hyper Backup data uses its own format. Multi-version backups are stored in the .hbk format and can only be read with Hyper Backup, Hyper Backup Explorer or Hyper Backup Vault.[13] An encrypted .hbk structure therefore cannot be treated like an ordinary collection of files.

How to verify that a backup is clean before restoring it is explained in the guide Restoring backups after ransomware. If the NAS served as a repository for backup software, also see Veeam backup after ransomware.

Checking snapshots safely without making things worse

Snapshots are the fastest way back. Used carelessly, though, they destroy exactly the state you need for analysis and for your insurer. Work in this order:

  1. Keep the network disconnected. Check locally or through an isolated management connection, not from the compromised network.
  2. Document the snapshot list. In Snapshot Replication > Snapshots, open the list for each shared folder and photograph it: timestamps, locks, and the shield icon marking immutable snapshots.[10]
  3. Establish when encryption started. Older snapshots are only clean if they were taken before the attackers' first access. In an admin compromise, incident response has to establish that.
  4. Look first, then copy. Browse lets you view a snapshot's contents and copy them out without changing the shared folder.[9]
  5. Restore as a copy. Clone with a new name creates a new shared folder from the snapshot.[9] The encrypted state stays untouched alongside it.
  6. Don't roll back. Restore to this snapshot resets the entire shared folder to the earlier state.[9] That only makes sense once data is secured, evidence is documented and the root cause has been dealt with.
  7. Don't delete snapshots. Not even "redundant" ones. After deletion, Btrfs frees the space in the background, and Synology explicitly refers to ongoing space reclamation.[8] Older states that a later reconstruction could have used disappear along with it.

A clone needs free space: Synology states at least 100 MB per shared folder for a restore or clone, but in practice you need as much as has changed since the snapshot.[9] If the pool is nearly full, copying out to an external target is the better option.

What not to do

Many Synology data losses only happen after the attack. The following steps write to the drives or erase traces:

  • Don't repair the volume or start a pool Repair. Repair is meant for degraded pools and rebuilds redundancy onto a replacement drive.[16] With ransomware, the pool is rarely the problem, but the write load is.
  • Don't delete or recreate a storage pool, and don't attach it to another unit via Online Assemble. Online Assemble brings in pools whose drives come from a different Synology NAS.[17] Any read-write mount writes new Btrfs transactions and can overwrite precisely the areas that hold older states.
  • Don't reset or reinstall DSM. Synology distinguishes two modes. Mode 1 resets the admin account, disables its two-factor authentication, switches the network to DHCP and turns off Auto Block and firewall rules. Mode 2 additionally wipes the entire system configuration, including the admin password and the encryption key vault, and requires DSM to be reinstalled.[15] Synology stresses that a reset does not affect stored data.[15] What is lost, though, is the configuration, the account state and the logs needed for the investigation. For encrypted volumes, the recovery keys are required after a reset.[15]
  • Don't move, swap or transplant drives into another NAS. A second unit may detect them as a foreign pool or offer to install DSM.
  • Don't run btrfs check --repair over SSH. The Btrfs documentation advises using --repair only when told to by a developer or experienced user, as no checking tool can fix every kind of damage.[18]
  • Don't install recovery software on the NAS, and don't copy data back onto the affected volume.
  • Don't delete encrypted files. They are needed to identify the family, for any decryption and for reconstruction.

If you need the drives as evidence for an insurer or a criminal complaint, see the guide Forensic evidence preservation after cyberattacks.

Reconstruction when there are no snapshots

If no snapshots are left, or they were never set up, the actual data recovery begins. It is carried out exclusively on sector-level images, never on the device itself.

Step 1: rebuild RAID and LVM from the images

Each member drive of an md array carries a superblock with the array information. With format 1.2, it sits 4 KiB from the start of the device.[21] From these superblocks, the order, RAID level and chunks can be reconstructed, and with SHR the multiple sub-arrays as well. The LVM layer is then rebuilt on top. Synology's own PC guide assembles the drives directly and mounts the volume read-only.[7] For a hardware failure, that is a legitimate route. After ransomware, this step belongs on copies, because assembly alone can update metadata.

Step 2: evaluate older Btrfs states

Btrfs writes changes to new locations via copy-on-write. When ransomware overwrites a file, the old blocks therefore often remain on the volume until the space is reallocated. Btrfs also keeps a list of several previous file system tree roots in the superblock.[19] Older tree generations allow directories and files to be addressed as they were at an earlier point. Tools such as btrfs restore only read and do not modify the file system image.[20] How far back you can get depends on how much was written after the attack.

Step 3: ext4 and deleted originals

On ext4, the search shifts to inodes, the journal and free space. Ransomware that writes an encrypted copy and deletes the original often leaves usable remnants there. If it overwrites in place, little can usually be recovered without the key.

Damage pattern and recovery path

Damage patternLikely causeRecovery path
Shares encrypted, DSM looks normal, snapshots presentInfected client via SMBClone the snapshot or copy via Browse; check the timestamp first
Shares encrypted, no snapshots, BtrfsClient via SMB, snapshots never scheduledImages, analysis of copy-on-write remnants and older tree generations
Shares encrypted, ext4Client via SMBImages, ext4 analysis, search for deleted originals; check the recycle bin
.encrypt files, note README_FOR_DECRYPT.txtteCh0raix after admin login[4]Identify the variant and decryptor status, review snapshots, otherwise reconstruction
Snapshots deleted, admin accounts changedCompromised DSM admin accountIncident response first; images, reconstruction at mdadm, LVM and Btrfs level
Immutable snapshots presentAdmin compromise, protection period still runningClone the snapshot and secure data before the period ends[10]
Pool "crashed" or volume no longer mountableAttack plus hardware fault or mishandling afterwardsStabilise drives, image them, reconstruct the RAID virtually
Hyper Backup target encrypted as wellTarget writable from the NASAnalysis of the .hbk structure on the target drive

Whether a decryptor exists for a family is covered on the ransomware decryption page. The fundamentals of reconstruction after ransomware are on the ransomware data recovery page. DATA REVERSE provides background on Btrfs and ext4 on its page on operating system and file system recovery (in German) (external link).

Incident response or data recovery?

The two often run in parallel but have different goals.

  • Incident response establishes how the attackers got into the network and into DSM, whether data was exfiltrated, and when the device can be operated safely again. It is essential as soon as admin accounts are involved or the ransomware came from a Windows system on the corporate network.
  • Data recovery reconstructs from drive images whatever can still be retrieved without a clean backup. DATA REVERSE handles Synology systems including SHR arrays; models and failure scenarios are listed on the page Synology data recovery at DATA REVERSE (in German) (external link).[22]

Which route fits your situation?

How a Synology analysis works

  1. Intake: model, DSM version, SHR or classic RAID, Btrfs or ext4, encrypted shared folders or not, snapshot and backup configuration, steps taken so far.
  2. Images: every drive is imaged read-only at sector level; failing drives are stabilised first.
  3. Virtual reconstruction: mdadm arrays, LVM and the file system are rebuilt from the images, not inside the NAS.
  4. Analysis: snapshots, recycle bin, older states, deleted originals and unencrypted regions of large files.
  5. Assessment and handover: which data is fully, partially or not recoverable? Handover on new drives.

For units with many drives, it is often simpler to hand over the complete NAS with all drives in their original order. General information on other vendors is available at NAS data recovery at DATA REVERSE (in German) (external link).

After the incident: don't run the NAS the same way again

Putting the device back on the network unchanged after recovery invites the next wave. Synology's own recommendations from the 2019 and 2021 attack waves make a good minimum standard:[2][3]

  • Disable the default admin account; use named admin accounts with strong, unique passwords and two-factor authentication.
  • Enable Auto Block and account protection, turn on the firewall and only open services when needed. Don't expose DSM directly to the internet; use a VPN for remote access.
  • Run Security Advisor regularly and keep DSM and packages up to date.
  • Schedule snapshots for all important shared folders, on supported models as immutable snapshots with the 7 to 14 day protection period Synology recommends.[10]
  • Keep a backup that can be neither changed nor deleted from the NAS, for example on a second unit with separate credentials. The concept is explained in the guide Immutable backup.
  • Don't do admin work from ordinary workstations, and don't store DSM passwords in client browsers.

Data recovery by system

Frequently asked questions

Can I recover an encrypted Synology NAS from a snapshot?

Often, yes, provided the volume uses Btrfs, snapshots were scheduled and the attackers lacked the administrator rights needed to delete them. Rather than using Restore to this snapshot, first expose the snapshot as a new shared folder with Clone with a new name, or copy individual data out of it. That keeps the encrypted state intact for analysis and for your insurer.

Will resetting my Synology NAS delete my data?

According to Synology, a reset does not affect stored data. Mode 1, however, resets the admin account, network settings, Auto Block and firewall rules and disables two-factor authentication for the admin account, while Mode 2 wipes the entire system configuration including the encryption key vault and reinstalls DSM. Evidence and possibly keys are lost in the process, so image the drives before any reset.

Is a Synology NAS with ext4 harder to recover than one with Btrfs?

With ext4 you lose shared folder snapshots, which Synology only offers on Btrfs volumes, and with them the easiest way back. Reconstructing deleted originals is still possible on ext4, but it depends heavily on how much was written to the volume after the attack.

Do immutable snapshots protect against ransomware?

They protect against deletion by compromised administrator accounts for as long as the protection period runs. Synology has offered them since DSM 7.2 on supported models and recommends a period of 7 to 14 days. They do not help if encryption goes unnoticed for longer than the protection period, so a separate backup is still needed.

Can I put the drives into a PC and read the data myself?

Synology documents this route for failed units using Ubuntu, mdadm and lvm2 with a read-only mount. After ransomware, be careful: assembling the array can update metadata, and the most valuable traces are in older, invisible states. Create sector-level images of all drives first and only work on copies.

Is there a decryptor for Synology ransomware?

For SynoLocker, Synology stated in 2014 that it could not decrypt files that had already been encrypted. For other families such as eCh0raix it depends on the specific variant. File extension, ransom note and sample files show whether a tool exists, and the snapshot and reconstruction route should be checked in parallel.

Related ransomware profiles

Read next

Sources and further reading

  1. [1]Synology – Synology Encourages Users to Update as SynoLocker Ransomware Affects Older DSM Versions (6 Aug 2014) synology.com
  2. [2]Synology – Synology Urges All Users to Take Immediate Action to Protect Data from Ransomware Attack (23 Jul 2019) synology.com
  3. [3]Synology – Synology Investigates Ongoing Brute-Force Attacks From Botnet (4 Aug 2021) synology.com
  4. [4]Palo Alto Networks Unit 42 – New eCh0raix Ransomware Variant Targets QNAP and Synology NAS Devices (10 Aug 2021) unit42.paloaltonetworks.com
  5. [5]BleepingComputer – eCh0raix ransomware now targets both QNAP and Synology NAS devices (10 Aug 2021) bleepingcomputer.com
  6. [6]Synology Knowledge Center – What is Synology Hybrid RAID (SHR)? kb.synology.com
  7. [7]Synology Knowledge Center – How can I use a PC to recover data when my Synology NAS malfunctions? kb.synology.com
  8. [8]Synology Knowledge Center – Snapshot Replication: Snapshots (DSM 7) kb.synology.com
  9. [9]Synology Knowledge Center – Snapshot Replication: Recovery (DSM 7) kb.synology.com
  10. [10]Synology Knowledge Center – What is an immutable snapshot? How do I use it? kb.synology.com
  11. [11]Synology – Press release: DSM 7.2 – Immutable storage, full-volume encryption, and more (22 May 2023) synology.com
  12. [12]Synology Knowledge Center – Enable Recycle Bin (DSM 7) kb.synology.com
  13. [13]Synology – Hyper Backup software specifications (DSM 7.2) synology.com
  14. [14]Synology – Active Backup for Business software specifications (DSM 7.2) synology.com
  15. [15]Synology Knowledge Center – How do I reset my Synology NAS? (For DSM 6.2.4 or above) kb.synology.com
  16. [16]Synology Knowledge Center – Repair a Storage Pool (DSM 7) kb.synology.com
  17. [17]Synology Knowledge Center – Assemble a Storage Pool (DSM 7) kb.synology.com
  18. [18]Btrfs documentation – btrfs check btrfs.readthedocs.io
  19. [19]Btrfs documentation – Mount options (backup roots) btrfs.readthedocs.io
  20. [20]Btrfs documentation – btrfs restore btrfs.readthedocs.io
  21. [21]mdadm(8) – Linux manual page man7.org
  22. [22]DATA REVERSE – Synology data recovery (German) datareverse-datenrettung.de
  23. [23]Synology – Snapshot Replication software specifications (DSM 7.2) synology.com