Neo23x0 / Raccine
- среда, 7 октября 2020 г. в 00:24:44
C++
A Simple Ransomware Vaccine
A Simple Ransomware Protection
We see ransomware delete all shadow copies using vssadmin
pretty often. What if we could just intercept that request and kill the invoking process? Let's try to create a simple vaccine.
We register a debugger for vssadmin.exe
(and wmic.exe
), which is our compiled raccine.exe
. Raccine is a binary, that first collects all PIDs of the parent processes and then tries to kill all parent processes.
Avantages:
vssadmin.exe
or wmic.exe
), which could lead to integrity problems and could break our raccination on each patch dayDisadvantages / Blind Spots:
vssadmin.exe delete shadows
(or any other blacklisted combination) isn't possible anymorevssadmin.exe delete shadows
, which could be a backup processvssadmin.exe
(e.g. via schtasks
)vssadmin.exe
(and wmic.exe
) gets intercepted and passed to raccine.exe
as debugger (vssadmin.exe delete shadows
becomes raccine.xe vssadmin.exe delete shadows
)Malicious combinations:
delete
and shadows
(vssadmin)resize
and shadowstorage
(vssadmin)delete
and shadowcopy
(wmic)delete
and catalog
and -quiet
(wbadmin)USE IT AT YOUR OWN RISK!
You won't be able to run commands that use the blacklisted commands on a raccinated machine anymore until your apply the uninstall patch raccine-reg-patch-uninstall.reg
. This could break various backup solutions that run that specific command during their work. It will not only block that request but kills all processes in that tree including the backup solution and its invoking process.
If you have a solid security monitoring that logs all process executions, you could check your logs to see if vssadmin.exe delete shadows
or vssadmin.exe resize shadowstorage ...
is frequently or sporadically used for legitimate purposes in which case you should refrain from using Raccine.
delete
and shadows
in their command line and otherwise pass all parameters to a new process that invokes vssadmin with its original parametersexplorer.exe
from the whitelistwmic
method calling delete shadowcopy
, no outputs for whitelisted process starts (avoids problems with wmic output processing)raccine-reg-patch-vssadmin.reg
to intercept invocations of vssadmin.exe
Raccine.exe
from the release section in the PATH
, e.g. into C:\Windows
(For i386 architecture systems use Raccine_x86.exe
and rename it to Raccine.exe
)
About 10-30% of Ransomware samples use wmic
to delete the local shadowcopies. However, wmic
is used for administrative activity far more often than vssadmin
. The output of wmic often gets processed by automated scripts. It is unknown how a proxied execution through Raccine affects these scripts and programs. We've removed all outputs for cases in which no malicious parameter combination gets detected, but who knows?
raccine-reg-patch-wmic.reg
patch to intercept invocations of wmic.exe
Ransomware often uses the command wbadmin delete catalog -quiet
to delete the backup catalog of the local computer.
raccine-reg-patch-wbadmin.reg
patch to intercept invocations of wbadmin.exe
raccine-reg-patch-uninstall.reg
Raccine.exe
(optional)Run raccine.exe
and watch the parent process tree die (screenshot of v0.1)
In case that the Ransomware that your're currently handling uses a certain process name, e.g. taskdl.exe
, you could just change the .reg
patch to intercept calls to that name and let Raccine kill all parent processes of the invoking process tree.
I'd like to extend Raccine but lack the C++ coding skills, especially o the Windows platform.
implemented by Ollie Whitehouse in v0.2.0
Since Raccine is registered as a debugger for vssadmin.exe
the actual command line that starts raccine.exe looks like
raccine.exe vssadmin.exe ... [params]
If we were able to process the command line options and apply filters to them, we could provide the following features:
delete shadows
vssadmin.exe
(transparent pass-through)We could provide a config file that contains white-listed parents for vssadmin.exe
. If such a parent is detected, it would also pass the parameters to a new process and skip killing the process tree.
The solution is outlined in this tweet and related talk.
Since malware tends to inject into explorer.exe
, we thought it would be a good idea to kill even explorer.exe
in order to avoid malicious code performing other operations on the system. What happens in real world examples is that a user that executed the Ransomware process would loose its windows task bar and desktop, while other programs like Microsoft Word or Outlook would still be running and the user would be able to save his work and close the respective programs before calling the helpdesk or simpy reboot the system. An expericend user could bring up task manager using CTRL+ALT+Del
and start a new explorer.exe
or just log off.
The right pronounciation is "Rax-Een".