[HOW TO] Reset your NAS after ransomware

Introduce yourself to us and other members here, or share your own product reviews, suggestions, and tips and tricks of using QNAP products.
FSC830
Experience counts
Posts: 2043
Joined: Thu Mar 03, 2016 1:11 am

[HOW TO] Reset your NAS after ransomware

Post by FSC830 »

Hi all, because in every thread caused by ransomware nearly every 2nd/3rd post is "how can I reset my NAS?".
Therefore here is a simple to do list!

Prerequisites: you need an actual backup of your data!

!!! IF YOU DO NOT HAVE AN ACTUAL AND CLEAN BACKUP, DO NOT FOLLOW THESE STEPS !!!

Addendum: if the encrypted data is not important for you, you can follow these advises to clean up the NAS. There will be no data recovered following this steps!

There are may be other procedures and if any malware resides in DOM these steps may be not efficient to clean up, depends to "how smart the malware" was done!
If you dont have a backup, I recommend to buy new disks and setup NAS with the new disks. Store infected disks in a safe please and wait, if any anti-malware process is available later (may be much later)!

Lets start over:

0. Make sure, NAS is not accessable from internet if you do not want to do this at a regular schedule!!!

1. If access to NAS is possible, write down your system settings/app settings.
2. Shutdown NAS
3. Remove all media (disks and - if installed NVMe devices)
4. Wipe all media at a PC. Usually it is sufficient to remove all partitions! If PC do not have a SATA connector, use an USB adapter instead.
5. Power on NAS
6. Use Qfinder tool to install latest firmware at NAS (yes, its possible without any media)
7. Insert media, for NVMe devices you need a power off!
8. Setup NAS again following the wizard. Do not restore any settings if you made them in #1! If you backupped settings prior NAS was hacked, you can use it, but I recommend not to do so.
9. Check, if any unusual files, services are existing. Check autorun.sh for any strange entries. If you did not write anything in autostart.sh, the file should be empty.
If you find your NAS is clean, proceed.
10. Create your shared folders, install and configure apps.
11. Restore your data from backup
12. May be the most important: think, how you can secure the NAS/LAN to avoid an infection in future. VPN is a good advise!

All steps at your own risk!
If someone have another idea how to cleanup, go ahead... :DD
Why do I not try a cleanup without wiping all media?
No one can be safe if malware did install some more traps, we do not know.
This can be a backdoor to ease up subsequent access, a small code, which uses the NAS as "jumphost" to takeover access of clients.
So if your NAS was infected, check your clients too!

Recommendations: do not expose NAS to internet without a secure connection (VPN is the outstanding solution)!!! Expose means that the NAS or services can be reached FROM the internet, not that NAS is able to connect to internet for downloading firmware/apps.
Anyhow: I recommend to download newer version of firmware and apps to your client PC at first and then perform a manually triggered update. This can be done using the GUI, for the firmware in control panel, for apps in AppCenter.

Note: for last recent updates (not only QTS 5) a lot of users report that it is best choice to reboot the NAS twice right after the update, to ensure all services are running without issues!

If after step 9 you find your NAS is not clean, i.e. you will find some strange/cryptic code in autorun.sh a so-called DOM recovery may be is mandatory.
But if not done properly, this can brick your NAS!!!
So if you convinced after step 9 your NAS is still affected, please request help in forum or with an local IT professional (costs money).

Do not continue at your own if your are not familiar with that, what are you doing!!


Regards and good luck
Last edited by FSC830 on Mon Feb 07, 2022 5:51 pm, edited 7 times in total.
luk325235
First post
Posts: 1
Joined: Mon Jan 31, 2022 11:56 pm

Re: [HOW TO] Reset your NAS after ransomware

Post by luk325235 »

Hi!
Question to Step 4. When you dont have a SATA USB adapter or PC with SATA connector can i also "Reinitialize" the NAS with QNAP?
User avatar
dolbyman
Guru
Posts: 35273
Joined: Sat Feb 12, 2011 2:11 am
Location: Vancouver BC , Canada

Re: [HOW TO] Reset your NAS after ransomware

Post by dolbyman »

you would have to purchase one ... an adapter I mean
FSC830
Experience counts
Posts: 2043
Joined: Thu Mar 03, 2016 1:11 am

Re: [HOW TO] Reset your NAS after ransomware

Post by FSC830 »

I would not recommend reinitializing the disks at NAS!
Think! The NAS recognizes somehow the data at disk, in every partition! A Windows PC does not. So I suppose it is safer to delete all partiton information at a PC.
If you use a Linux you must not mount the partitions too, just delete partition information.

Regards
RB2022
New here
Posts: 4
Joined: Sat Jan 08, 2022 6:16 am

Re: [HOW TO] Reset your NAS after ransomware

Post by RB2022 »

We have done a factory reset of our NAS and did a clean setup again.
But now when we try to open some apps we get the error messages as you can see in the screenshots we took ( see attached )

We also did a firmware check but it stays on Firmware: 5.0.0.1891 from end of December 2021. So does this mean the deadbold forced update is not applicable for our model ? (TVS-471)
You do not have the required permissions to view the files attached to this post.
END3RL3
New here
Posts: 6
Joined: Sat Apr 06, 2019 10:16 pm

Re: [HOW TO] Reset your NAS after ransomware

Post by END3RL3 »

Here's the step I can't seem to find -

If you had a backup, the new encrypted .deadbolt files will be copied to the backup if you didn't catch it before the backup ran. The original files will still be on the backup as well.

Let's say you had 5TB of data on the NAS.
Your USB backup is 6TB.
The new deadbolt data is now not going to copy to the backup due to space but let's say you added data to the NAS (without knowing of deadbolt). Now this data is NOT backed up.

You will want to keep the new data that becomes encrypted but delete the .deadbolt file ONLY IF you have the original file.

I feel like a script to loop /share and if deadbolt file exists, it checks for an original and if it is there then it deletes the deadbolt file. If it is not there then it moves it to a directory so if QNAP ever releases the master decryption key you can get that data.

Anyone have a script like this avail?
lousyfool
Getting the hang of things
Posts: 74
Joined: Tue Apr 20, 2021 1:45 pm

Re: [HOW TO] Reset your NAS after ransomware

Post by lousyfool »

END3RL3 wrote: Mon Feb 07, 2022 2:26 amI feel like a script to loop /share and if deadbolt file exists, it checks for an original and if it is there then it deletes the deadbolt file. If it is not there then it moves it to a directory so if QNAP ever releases the master decryption key you can get that data.

Anyone have a script like this avail?
Searching helps. Done it for you and found viewtopic.php?f=45&t=164797&p=809397&hi ... pt#p809397
END3RL3
New here
Posts: 6
Joined: Sat Apr 06, 2019 10:16 pm

Re: [HOW TO] Reset your NAS after ransomware

Post by END3RL3 »

Thank you very much!

I did a search (several actually), seemed as though too many personal opinions were in the thread as opposed to procedural steps based on condition. I went through 10+ pages of how QNAP should do better and sarcasm around how "of course everybody has a backup, ...right?"....
lousyfool
Getting the hang of things
Posts: 74
Joined: Tue Apr 20, 2021 1:45 pm

Re: [HOW TO] Reset your NAS after ransomware

Post by lousyfool »

END3RL3 wrote: Mon Feb 07, 2022 2:47 amI did a search (several actually) ... I went through 10+ pages ...
There's a field for searching inside a thread on every thread page. Using that in the DeadBolt thread and searching for the term "script" quickly produces the post I linked to.
<sarcasm>Didn't know/use/find it? Ok, blame QNAP. Or the forum software. Or me.</sarcasm> :P
FSC830
Experience counts
Posts: 2043
Joined: Thu Mar 03, 2016 1:11 am

Re: [HOW TO] Reset your NAS after ransomware

Post by FSC830 »

RB2022 wrote: Sun Feb 06, 2022 9:35 pm We have done a factory reset of our NAS and did a clean setup again.
But now when we try to open some apps we get the error messages as you can see in the screenshots we took ( see attached )

We also did a firmware check but it stays on Firmware: 5.0.0.1891 from end of December 2021. So does this mean the deadbold forced update is not applicable for our model ? (TVS-471)
1. QTS 5.0.0.1891 is the latest version!
2. An forced update is a rumor! There is no forced update triggered from QNAP! If there was an unexpected update you should check your Auto-Update options.
This can also be seen in log: there is an entry Auto-update started!
If you disabled auto update sometime ago, check if there was another firmware update v4.5.3 afterwards. This update most likely sets auto update options to "enable".
3. From which apps are you talking?
4. Did you recover some configuration settings from a backed up config file?

Regards
FSC830
Experience counts
Posts: 2043
Joined: Thu Mar 03, 2016 1:11 am

Re: [HOW TO] Reset your NAS after ransomware

Post by FSC830 »

END3RL3 wrote: Mon Feb 07, 2022 2:26 am Here's the step I can't seem to find -

If you had a backup, the new encrypted .deadbolt files will be copied to the backup if you didn't catch it before the backup ran. The original files will still be on the backup as well.
...
See what I did wrote in entry post:
!!! IF YOU DO NOT HAVE AN ACTUAL AND CLEAN BACKUP, DO NOT FOLLOW THESE STEPS !!!
If you have been hit and do NOT have an actual and clean backup, there is no one-for-all advise, you have to look up an individual solution.

Regards
Last edited by FSC830 on Mon Feb 07, 2022 5:51 pm, edited 1 time in total.
User avatar
Moogle Stiltzkin
Guru
Posts: 11445
Joined: Thu Dec 04, 2008 12:21 am
Location: Around the world....
Contact:

Re: [HOW TO] Reset your NAS after ransomware

Post by Moogle Stiltzkin »

FSC830 wrote: Tue Feb 01, 2022 12:30 am I would not recommend reinitializing the disks at NAS!
Think! The NAS recognizes somehow the data at disk, in every partition! A Windows PC does not. So I suppose it is safer to delete all partiton information at a PC.
If you use a Linux you must not mount the partitions too, just delete partition information.

Regards
good point.

normally i pull out a drive, and use a usb hdd docker connected to my pc, then access windows disk management (or aomei partition assistant) and remove all partitions and wipe the drive.


also i'm a strong believer in prevention is better than the cure. so anyone who got hit, after you manage to recover, take a good long hard look at your setup and security practises, consider what you can do to improve it going forward, so you won't be hit again as lessons were not learned. if you don't know, check youtube, reddit or on the forum. if after searching and you still don't understand, ask and people will chime in to help to provides tips.

a few short tips
- keep backups
- update regularly (usually this isn't a set it and forget it thing. you have to properly maintain your network and the devices on it, or you will get hit eventually)
- don't expose your nas (if you really need to use remote, probly use a vpn)
NAS
[Main Server] QNAP TS-877 (QTS) w. 4tb [ 3x HGST Deskstar NAS & 1x WD RED NAS ] EXT4 Raid5 & 2 x m.2 SATA Samsung 850 Evo raid1 +16gb ddr4 Crucial+ QWA-AC2600 wireless+QXP PCIE
[Backup] QNAP TS-653A (Truenas Core) w. 4x 2TB Samsung F3 (HD203WI) RaidZ1 ZFS + 8gb ddr3 Crucial
[^] QNAP TL-D400S 2x 4TB WD Red Nas (WD40EFRX) 2x 4TB Seagate Ironwolf, Raid5
[^] QNAP TS-509 Pro w. 4x 1TB WD RE3 (WD1002FBYS) EXT4 Raid5
[^] QNAP TS-253D (Truenas Scale)
[Mobile NAS] TBS-453DX w. 2x Crucial MX500 500gb EXT4 raid1

Network
Qotom Pfsense|100mbps FTTH | Win11, Ryzen 5600X Desktop (1x2tb Crucial P50 Plus M.2 SSD, 1x 8tb seagate Ironwolf,1x 4tb HGST Ultrastar 7K4000)


Resources
[Review] Moogle's QNAP experience
[Review] Moogle's TS-877 review
https://www.patreon.com/mooglestiltzkin
dosborne
Experience counts
Posts: 1822
Joined: Tue May 29, 2018 3:02 am
Location: Ottawa, Ontario, Canada

Re: [HOW TO] Reset your NAS after ransomware

Post by dosborne »

FSC830 wrote: Mon Feb 07, 2022 5:52 am 2. An forced update is a rumor! There is no forced update triggered from QNAP! If there was an unexpected update you should check your Auto-Update options.
Most sites seem to disagree and state there was indeed a forced update, under certain conditions. However, neither of my 4.5.4.1892 units were touched during this time so that my have been a limiting factor too.

https://www.bleepingcomputer.com/news/s ... 0-devices/

https://www.reddit.com/r/qnap/comments/ ... jan_2627th

https://www.zdnet.com/article/decryptor ... s-devices/

https://www.techspot.com/news/93220-qna ... users.html

https://www.pcmag.com/news/dont-ignore- ... installing

Pretty sure I had a link to QNAP admitting to it as well, but can't easily find it again at the moment.
QNAP TS-563-16G 5x10TB Seagate Ironwolf HDD Raid-5 NIC: 2x1GB 1x10GbE
QNAP TS-231P-US 2x18TB Seagate Exos HDD Raid-1
[Deadbolt and General Ransomware Detection, Prevention, Recovery & MORE]
lousyfool
Getting the hang of things
Posts: 74
Joined: Tue Apr 20, 2021 1:45 pm

Re: [HOW TO] Reset your NAS after ransomware

Post by lousyfool »

Explanation of "forced" or auto-updates: viewtopic.php?f=45&t=164923#p809634
So, there's a thread on this already... perhaps continue that specific topic there before this here goes way off topic?
FSC830
Experience counts
Posts: 2043
Joined: Thu Mar 03, 2016 1:11 am

Re: [HOW TO] Reset your NAS after ransomware

Post by FSC830 »

lousyfool wrote: Mon Feb 07, 2022 2:41 pm Explanation of "forced" or auto-updates: viewtopic.php?f=45&t=164923#p809634
So, there's a thread on this already... perhaps continue that specific topic there before this here goes way off topic?
Correct, answer moved to other thread 8)
viewtopic.php?f=45&t=164923#p810461

Regards
Post Reply

Return to “Users' Corner”