Synology NAS encrypted by ransomware: 29,258 files and 323 GB recovered from Btrfs old blocks

The device sent in was a Synology DS418play, four bays, with /volume1 on Btrfs. It was the company file share for a business in Chongqing.
One morning staff found every filename carrying a .L0CK3D suffix and every file opening as garbage, with a ransom note in the directory. IT took the NAS offline and brought the whole unit to us.
The first question in these cases is always "can everything come back". The honest answer is that it depends on how much of the pre-encryption content was later overwritten by new writes — not on how aggressive the malware was or how expensive the hardware. Here the result was 29,258 of 119,105 business files recovered, 323 GB exported, and 89,847 files lost for good.
Why anything survives encryption
The storage used Btrfs, whose copy-on-write behaviour means a file is never overwritten in place: new content is written elsewhere and the pointer is changed.
Ransomware reads the original, encrypts it, and writes the ciphertext back. On Btrfs, the pre-encryption data blocks often remain on the platters with no pointer referring to them. As long as those blocks have not been reused by later writes, the original content is still there.
So this is not decryption. Without the key, decryption is impossible. This is recovering the pre-encryption version from the file system's own history.
Why the in-memory key route was closed
During encryption the key sits in the device's memory. The more complete route in the industry is to freeze the encryption process before shutdown, capture memory in full, extract the master key and decrypt in bulk — the only method that restores everything.
This unit had already been rebooted and powered down, so the memory contents were gone. That left the file system route, and how much could be recovered depended entirely on how many old blocks remained.
Process
- Read-only takeover. The four drives were removed in their original order and mounted read-only. All analysis ran on images; not one byte was written to the originals, because a reused block is gone forever.
- Full-volume inventory. 561,954 encrypted files were counted, including system files, caches and thumbnails. After removing non-business content, 119,105 business files were confirmed as the recovery target.
- Confirm the encryption generation. This family tags files by generation. Identifying which files were encrypted in the same pass avoided treating already-overwritten blocks as candidates.
- Build the old-block repository. Every block on the platters that had no pointer but intact content was registered into an index — the most time-consuming step and the foundation for everything after.
- File-by-file matching. For each encrypted file, candidate old blocks were located by size, position and residual content. Matches were rebuilt; non-matches were recorded as losses, not guessed at.
- Batch export and verification. Suffixes removed, original structure restored, exported in batches. Verification meant opening files, not just exporting them: photos decoded at full resolution, documents opened, no encryption suffix left in the output.
A first pass of 5,312 files (about 53 GB) confirmed the method and that the output held up to opening, before the full volume was processed. Building the repository and exporting everything took three days.
Result
Of 119,105 business files, 29,258 were recovered and exported: 29,306 files totalling 323 GB with no encryption suffix remaining, in the original folder structure.
| Item | Detail |
|---|---|
| Business files in total | 119,105 |
| Recovered | 29,258 (24.6%) |
| Not recovered | 89,847, of which: 78,502 overwritten in place (~2,073 GB); 11,307 with no usable candidate block (1.9 GB); 34 only partially recoverable (3.7 GB); 4 with no rewrite record (6.3 GB) |
| Exported | 29,306 files / 323 GB, zero encryption suffixes |
| Time | 3 days from repository build to full export |
By volume, most of what came back was photos and video from home and personal folders (220 GB), then audio files (66 GB, 6,350 files) and company engineering files (29 GB, 2,895 files).
Why only a quarter
The ratio is poor, but it is normal for this class of case, and it is exactly why we do not promise full recovery on intake. Of the 89,847 lost files, 78,502 (about 2,073 GB) were overwritten in place — the encryption wrote over the original block in a way that left no copy-on-write remnant. Another 11,307 (1.9 GB) had no usable candidate block anywhere on the platters, 34 were only partly recoverable and 4 had no rewrite record at all.
For the same ransomware, the recovery rate depends on how much spare history the volume holds: whether files were overwritten in place, how much new data was written after encryption, and whether snapshots existed. What we can promise is the standard — every delivered file was opened and checked, and nothing was padded to raise the count.
Advice for anyone running a NAS
- Snapshots are the cheapest insurance. On Btrfs, snapshots taken before encryption remain readable afterwards and cost almost nothing to restore. This unit had none.
- A NAS is not a backup. When the NAS is hit, the computers mounted to it and their mapped drives are hit too. A real backup lives on another device, in another place, offline or read-only.
- Do not expose DSM to the internet. Weak passwords and unpatched versions are the usual entry points. Keep the admin interface internal and use a VPN for remote access.
- On discovery, power down and disconnect. Do not reboot, do not reinstall DSM, do not clean the shares. Every write consumes old blocks that could still be recovered.
- Preserve the evidence first. Photograph the ransom note, the renamed files and the timestamps; they are needed to work out the entry point and the scope.
If filenames in a share suddenly change in bulk, stop writing to the volume and call before anything is restarted.
Send the model and the symptom; we will tell you what is realistic.
Related records
- Car dealership RAID5 with two failed members: sales and finance data back in 48 hours
- Tianheyuan club — ordering-system database repaired
- Wulidian Primary School — Dell rack servers deployed
- Chongqing hospital — ransomware (PGKHVSLOE) encrypted the finance database
- Chongqing University — PowerEdge R630 cluster
- Chongqing MCC Construction — on-site data handling