Could this idea against ransomwares be possible?

BoraMurdar

Community Manager
Verified
Staff Member
Well-known
Aug 30, 2012
6,598
a malware using a Loop to find drives letters and files inside will only retrieve "C:"
I think some Cryptolocker variants into ZBots are actually looking for a filesystem, rather than just a partition letter, so I suppose if you hide your partition or disable it's name presenter or letter/label presenter, it will not stop it for accessing the partition
 

DardiM

Level 26
Verified
Honorary Member
Top Poster
Malware Hunter
Well-known
May 14, 2016
1,597
I think some Cryptolocker variants into ZBots are actually looking for a filesystem, rather than just a partition letter, so I suppose if you hide your partition or disable it's name presenter or letter/label presenter, it will not stop it for accessing the partition
Yes, maybe, that is also why I have specified "using a Loop to find drives letters and files inside" :)

And as tip for this example :
...
maybe you are out of home , with your laptop and you can't backup until you come home , and so you have to find another way to protect untill evening .
...
 
Last edited:

Dirk41

Level 17
Thread author
Verified
Top Poster
Well-known
Mar 17, 2016
797
Thank you all for clarifications .

May I ask another curiousity ? What if , while a ransomware starts encrypting , you unplug your PC from the electricity ? Does the ransom starts again to encrypt when you start again the PC ?

And what if you take that drive infected and connect it to another PC ? The ransomware encrypt the new PC ?
If I had the hardware , i Would try al these things
 

DardiM

Level 26
Verified
Honorary Member
Top Poster
Malware Hunter
Well-known
May 14, 2016
1,597
What if , while a ransomware starts encrypting , you unplug your PC from the electricity ? Does the ransom starts again to encrypt when you start again the PC ?

Some ransomware change some value (reg and start folder) to make them run at pc restart.

unplug your PC from the electricity : => can damage you PC

And what if you take that drive infected and connect it to another PC ? The ransomware encrypt the new PC ?

If you connects it as "slave" (I mean secondary HD, etc, ...) :

Few chance that the ransom encrypts anything, this way : he has to be running.
(just be sure to delete the bad file and removed eventual infected files : AV scans , etc,...)​
 
Last edited:
W

Wave

Thank you all for clarifications .

May I ask another curiousity ? What if , while a ransomware starts encrypting , you unplug your PC from the electricity ? Does the ransom starts again to encrypt when you start again the PC ?

And what if you take that drive infected and connect it to another PC ? The ransomware encrypt the new PC ?
If I had the hardware , i Would try al these things
It depends on the ransomware / how the ransomware works. Each sam

When you run the ransomware sample, if it uses a method to make itself re-execute at system start-up, then the answer to your first question would be yes. However not all ransomware samples will do this, but it is very common for malware to add itself to start-up (generally speaking).

There are many ways for malware to re-execute at start-up... I will list a few methods:
  • Standard approach via registry: "\\REGISTRY\\MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", "\\REGISTRY\\USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", "\\REGISTRY\\MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnce" and "\\REGISTRY\\USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnce"
  • Usage of a Start-Up folder built-into Windows: e.g. C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp - however this is a protected directory (administrator privileges will be required).
  • Utilisation of the Windows Task Scheduler to create an event to start the target PE at boot (well actually it happens after the user has signed into their account - however with this method the malware can have it's executable auto-elevated, bypassing the UAC alert).
  • Hijacking of external programs (e.g. patch up another program which is going to start-up automatically but is vulnerable to modification, so when it runs it will silently execute the newly added malicious code to start-up the malicious PE into memory... Another example of this would be hijacking a DLL which is used by vulnerable software (therefore loaded) so the malicious code becomes executed).
However without that being said, \\MACHINE\\ locations on the registry are protected areas and utilisation of the Windows Task Scheduler to create an event to auto-start a program (bypassing the UAC alert) both require admin privileges. Therefore, if UAC is enabled and you do not go around aimlessly allowing programs to run with administrator privileges then you'll be much safer.

Locations such as Program Files are also protected directories and will require administrator privileges to modify the contents, protecting programs from being patched if they are present in their own sub-directories in those protected areas... As long as the malware doesn't have admin privileges.

Without that being said, some ransomware will abuse their current privileges to make it trickier to identify suspicious processes running on the system throughout the encryption process. Therefore, they may conceal evidence of the malicious ransomware processes being ran via rootkit techniques (so if you opened up Process Manager you wouldn't be able to find the ransomware process, leaving you unaware of the presence) or just inject code into other processes (/work with methods like Dynamic Forking) for the encryption code execution.

On Windows 8/8.1 and Windows 10, system processes are not as vulnerable as they used to be back on older OS versions like Windows Vista and Windows 7. Therefore, malware can no longer just open a handle to csrss.exe (or other system processes) and use this handle for DLL/Code injection.

And what if you take that drive infected and connect it to another PC ? The ransomware encrypt the new PC ?
Not unless there is some sort of exploit being used to auto-execute code once the drive becomes connected to the system (e.g. USB devices with AutoRun usage). However if some of the files were injected with malicious code to re-start the encryption process (as opposed to being completely encrypted and useless as expected) then running the infected document can result in re-infection on the new system... Of course you wouldn't expect a scenario like this and you may have never heard of such scenario occuring but it is very possible and at the end of the day if they are developing malware then don't trust anything.

Make sure you always have an updated system backup image/your personal documents backed up and in the case of any infection you can revert via the backups instead of dealing with the infected mess (well most of the time). Once your system becomes infected, unless you had the samples to perform full analysis and understand the entire internals of the sample, you can never be sure if your system is fully clean after performing cleaning methods (even if all scanners claim the system is clean) - which is why a lot of people tend to just re-format their HDDs, reinstall the OS and use backups of their personal documents which they had previously taken and securely stored.
 
Last edited by a moderator:
L

LabZero

Thank you all for clarifications .

May I ask another curiousity ? What if , while a ransomware starts encrypting , you unplug your PC from the electricity ? Does the ransom starts again to encrypt when you start again the PC ?

And what if you take that drive infected and connect it to another PC ? The ransomware encrypt the new PC ?
If I had the hardware , i Would try al these things
Most malware attempts do start themself at boot time, by modifying specific registry keys and as well explained by @Wave.
Ransomware usually does not exception, and when Windows starts, it continues to encrypt files.
You consider that a few minutes are needed to complete the job, depending from the files number.

In the installation of an operating system one of the typical phases is to divide the hard disk in partitions. One of these, the one that hosts the operating system
, is marked as the active partition, or bootable partition. In this way the BIOS will be able to identify the partition from which to load the operating system.

So if HDD is connected as only and main one and admitted that the BIOS does not give objections, the OS might load by launching the ransomware.
In the case of a secondary HDD the ransomware should be manually activated.
 
Last edited by a moderator:

Dirk41

Level 17
Thread author
Verified
Top Poster
Well-known
Mar 17, 2016
797
Wow thank you , so always better( yeah the best thing is backup I know )an ssd/ hd for SO and app and a second hd for documents that won't boot in another PC ( paying attention , as @Wave said , that your files are not infected )
 
  • Like
Reactions: DardiM and LabZero
W

Wave

Wow thank you , so always better( yeah the best thing is backup I know )an ssd/ hd for SO and app and a second hd for documents that won't boot in another PC ( paying attention , as @Wave said , that your files are not infected )
All you need to do is either make regular system backups or just backup the important/personal documents to an external device (e.g. removable external HDD), and make sure you don't leave this plugged into your system (so if you became infected with virus, worm or ransomware for example it won't be able to find your device to attack it if it's not plugged in). And then use the backup once you become infected to restore back/recover files after format + OS reinstall :)

Edit: I do want to quickly add in before this conversation ends that using a firewall component should improve your protection against ransomware infections. The reason for this is because the ransomware (well most that are done properly with the keys) will send the private keys over to the server (and receive instructions back from the Command and Control server) and therefore if you are using a firewall you may be able to potentially mitigate the attack by blocking the connections. ;)

Without that being said, if you ever get a firewall alert about connections going through the Tor network (*.orion) then always make sure to block this unless you really do trust the program making the connections because this would be a suspicious sign of bad network activity on-going - since the Tor network is used for anonymity and of course ransomware authors do not want to be tracked. (not all ransomware will connect through Tor though, and most will just give you the Bitcoin address after encryption and make you do everything yourself with the steps).
 

Dirk41

Level 17
Thread author
Verified
Top Poster
Well-known
Mar 17, 2016
797
Wait.. @LabZero @Wave @everyone in case there was just one hd with os and docs, what if you connect it to another PC but enter Windows in safe mode ?
 
Last edited:
H

hjlbx

Because of the whole can of worms that executing an unknown file might create, the best protection is:

1. do not execute the process on the physical system in the first place - either by user behavior, a software that prevents it or a combo thereof;
2. if you do execute it then use virtualization or rollback software;
3. backup valuable datas

The only thing the Youtubers prove time-and-again is the utter futility of relying upon security soft A, B, C,... or X, Y or Z; each security soft will fail under particular circumstances. When they do fail, sometimes the damage is little, sometimes the damage is a lot, but there will be damage. Even when using virtualization, rollback and image restore software there is no guarantee that everything will turn out OK after an infection. I have seen irreversible damage during malware testing that virtualization, rollback and image restore software cannot fix - and in the end - it required a clean install of the OS.

Adhering to (1) above will always provide the best security and save the user from a whole lot of frustration and disappointment.
 
L

LabZero

Wait.. @LabZero @Wave @everyone in case there was just one hd with os and docs, what if you connect it to another PC but enter Windows in safe mode ?
Malware's life depends by Windows. In normal mode malware, ransomware load themselves at boot, so as soon as you turn on the PC the malware is active...
Instead, by entering in safe mode, only the vital and needed Windows processes are loaded , so the ransomware & malware remain in state of latency without activity and, moreover, it is even easier to kill them.
 

NekoHr

Level 3
Verified
Well-known
Feb 5, 2016
139
If you are taking disk out and in another computer you might as well start some Live CD Linux or AV and clean disk that way before starting it in Windows.
 
  • Like
Reactions: DardiM and Dirk41

Dirk41

Level 17
Thread author
Verified
Top Poster
Well-known
Mar 17, 2016
797
If you are taking disk out and in another computer you might as well start some Live CD Linux or AV and clean disk that way before starting it in Windows.

If they find it ...
 
  • Like
Reactions: DardiM
W

Wave

Wait.. @LabZero @Wave @everyone in case there was just one hd with os and docs, what if you connect it to another PC but enter Windows in safe mode ?
Malware's life depends by Windows. In normal mode malware, ransomware load themselves at boot, so as soon as you turn on the PC the malware is active...
Instead, by entering in safe mode, only the vital and needed Windows processes are loaded , so the ransomware & malware remain in state of latency without activity and, moreover, it is even easier to kill them.
More sophisticated malware can start up in safe mode by utilising the following registry key: "\\REGISTRY\\MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\"

You can also get a service to be started up in safe-mode by utilising the following registry key: "\\REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\SafeBoot\\Minimal\\MaliciousService1" (replace "MaliciousService1" with your own service name for example, etc).

I believe there is also a method where you utilise the standard method of using "\\REGISTRY\\MACHINE\\SOFTWARE\\Microsoft\\CurrentVersion\\RunOnce" - you add an asterisk at the start of the value name ("*") and therefore the program will start-up only one time at first Safe Mode boot.

Other methods could include hijacking system core components, such as Windows files, which are still used for Safe Mode (and thus when they become loaded, your malicious code becomes executed to start up a program). However this would be much more difficult to do and it may not even work correctly, without me manually testing I cannot comment further on this.

Of course there will be other methods, the above are just some examples. :)

Stay safe,
Wave. ;)
 
L

LabZero

More sophisticated malware can start up in safe mode by utilising the following registry key: "\\REGISTRY\\MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\"

You can also get a service to be started up in safe-mode by utilising the following registry key: "\\REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\SafeBoot\\Minimal\\MaliciousService1" (replace "MaliciousService1" with your own service name for example, etc).

I believe there is also a method where you utilise the standard method of using "\\REGISTRY\\MACHINE\\SOFTWARE\\Microsoft\\CurrentVersion\\RunOnce" - you add an asterisk at the start of the value name ("*") and therefore the program will start-up only one time at first Safe Mode boot.

Other methods could include hijacking system core components, such as Windows files, which are still used for Safe Mode (and thus when they become loaded, your malicious code becomes executed to start up a program). However this would be much more difficult to do and it may not even work correctly, without me manually testing I cannot comment further on this.

Of course there will be other methods, the above are just some examples. :)

Stay safe,
Wave. ;)
Thanks for the correction, well explained! :)
 

Dirk41

Level 17
Thread author
Verified
Top Poster
Well-known
Mar 17, 2016
797
Wow what a useful clarifications you provide ! Thank you !
@Wave you always refer to w7 or also w10 ?
 
  • Like
Reactions: DardiM
W

Wave

Wow what a useful clarifications you provide ! Thank you !
@Wave you always refer to w7 or also w10 ?
Both. ;)

For example (I'll use the first key I mentioned earlier as the example), there is a key under "\\REGISTRY\\MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\" called "Userinit" and the value by default should be: "C:\WINDOWS\system32\userinit.exe,", however you can add your own to the value and have it executed at Safe Mode start-up also.

(Anyone reading - please do not do something like this unless you know exactly what you are doing... These sort of system modifications are not considered to be "safe").

Without that being said, you'll require administrator privileges to alter that key since it's under "\\MACHINE\\" (HKEY_LOCAL_MACHINE).

It should work fine on Windows Vista, 8/8.1 and Windows 10 just like it should on Windows 7 (both x86 and x64 versions).

Edit:
Decided to do some quick-time reverse engineering to get you a few more details (which may or may not mean anything to you - depends if you have experience in software development or not):

Userinit.exe will utilise standard Win32 APIs to execute programs (it will use kernel32.dll!CreateProcessW).

It also implements some anti-reversing techniques such as usage of the IsDebuggerPresent API (from kernel32.dll library also).

It imports some functions which allow it to perform some registry operations such as open/enumerate registry keys.

At some point during execution flow it will utilise the following DLLs:
"WLDAP32.dll",
"ntdll.dll" (so it can utilise the NTAPI),
"logoncli.dll",
"netutils.dll",
"ext-ms-win-session-userinit-l1-1-0.dll", "api-ms-win-core-file-l1-2-1.dll", "api-ms-win-core-processenvironment-l1-2-0.dll", "api-ms-win-core-registry-l1-1-0.dll", "api-ms-win-core-errorhandling-l1-1-1.dll", "api-ms-win-core-processthreads-l1-1-2.dll", "api-ms-win-eventing-classicprovider-l1-1-0.dll", "api-ms-win-core-synch-l1-2-0.dll", "api-ms-win-core-heap-l2-1-0.dll", "api-ms-win-core-string-l2-1-0.dll", "api-ms-win-core-sysinfo-l1-2-1.dll", "api-ms-win-core-handle-l1-1-0.dll", "api-ms-win-core-heap-l1-2-0.dll", "api-ms-win-core-libraryloader-l1-2-0.dll", "api-ms-win-core-string-obsolete-l1-1-0.dll", "api-ms-win-crt-runtime-l1-1-0.dll", "api-ms-win-crt-private-l1-1-0.dll", "api-ms-win-core-profile-l1-1-0.dll", "api-ms-win-core-interlocked-l1-2-0.dll", "api-ms-win-core-debug-l1-1-1.dll", "api-ms-win-core-delayload-l1-1-1.dll", "api-ms-win-core-apiquery-l1-1-0.dll ".

(it imports functions from these various Dynamic Link Libraries).

It imports some undocumented Win32 functions (CreateExplorerSessionKey, SetShellDesktopSwitchEvent, SetupHotKeyForKeyboardLayout, DisplayMessageAndExitWindows, ....).
 
Last edited by a moderator:

Dirk41

Level 17
Thread author
Verified
Top Poster
Well-known
Mar 17, 2016
797
Hi! Could someone clarify me another thing : if you connect usb while there isa ransomware infection in a PC , it crypt also files in the usb drive/unit .

But can the ransomware transfer itself in the external hd/ usb stick ?

Thank you
 
  • Like
Reactions: DardiM and frogboy

About us

  • MalwareTips is a community-driven platform providing the latest information and resources on malware and cyber threats. Our team of experienced professionals and passionate volunteers work to keep the internet safe and secure. We provide accurate, up-to-date information and strive to build a strong and supportive community dedicated to cybersecurity.

User Menu

Follow us

Follow us on Facebook or Twitter to know first about the latest cybersecurity incidents and malware threats.

Top