We have written two PowerShell scripts that function just like ransomware. One script encrypts the data, and the other script decrypts the data using a public/private key pair. We created these as a tool so that you can test your defenses against actual ransomware. The purpose of the decrypter is to ensure that your files aren't permanently destroyed.
Here is an overview of how it works.
###USE AT YOUR OWN RISK - THESE SCRIPTS ARE PROVIDED FREE OF CHARGE - WATCHPOINT DOES NOT PROVIDE SUPPORT FOR THESE SCRIPTS. THIS IS A FREE TOOL FOR TESTING PURPOSES ONLY. DO NOT RUN IN A PRODUCTION ENVIRONMENT.###
The decryption script does the same thing, except that it decrypts files instead of encrypting them. The script also makes a copy of every file before it encrypts them. It stores the copy in env:temp. It should go without saying, but please make sure you have a good backup before running this simulation, as the files will be encrypted. Make sure that you have permission. WatchPoint is not responisble for any outcome of running these scripts. If you know what you're doing then it's safe, if not then please don't do it!
Here are the steps to run the ransomware simulation:
The Environment:
The simulation:
As mentioned previously, you’re going to need a test computer from which to run the simulation. In my example, I am using a Windows 8 computer, but Windows 7 and Windows 10 will work just fine.
c. If you have already have a certificate, then you’ll see output similar to the one below. If so, proceed to step 4. Otherwise keep following the steps to create a certificate.
d. Follow these steps if you don’t have a certificate.
i. Open mmc.exe.
ii. File > Add/Remove Snap-In > Certificates > My user account > Finish > Ok.
iii. Expand certificates > Personal > Certificates.
iv. All tasks > request new certificate.
v. Next > Next at Active Directory Enrollment >
vi. Checkbox for User > Enroll
viii. You should see output similar to this:
4. Now we need to copy the thumbprint id so we can use it in both the encryption and decryption script.
5. Copy the thumbprint id to the PowerShell scripts, see below:
Before:
After:
6. Next, map a drive to the server share that we want to run the simulated attack against. It’s important to know that the PowerShell scripts attack the lowest drive letter. I always map the Z: drive to the share that I am testing.
8. It’s time to run the PowerShell ransomware/encryption script. Right click and select ‘Run with PowerShell.'
9. You should immediately start seeing output like this:
10. Now let’s check our plain text file. As you’ll see it’s not clear-text anymore, which means the encryption worked!
But did our defenses work? Only you can answer that question, but if you had CryptoStopper, then it definitely did!
11. Next we use the decrypt, to decrypt our files. Just like before, right-click and select ‘Run with PowerShell.'
12. Presto! The original file is back!
On a side note, and as I mentioned earlier, the script makes a copy of every file it encrypts to the env:temp directory, aka C:\users\username\AppData\Local\Temp. So if you didn’t heed the warnings in steps 1 and 2, then you can check this directory for a copy of the files, just in case the decryption didn’t work.
That’s it. You now have a simple and effective way to test the security of your network against a simulated ransomware attack. And because we have the decrypter, you can undo the affects of the ransomware attack. Feel free to put CryptoStopper to the test by downloading a free trial.
###USE AT YOUR OWN RISK - THESE SCRIPTS ARE PROVIDED FREE OF CHARGE - WATCHPOINT DOES NOT PROVIDE SUPPORT FOR THESE SCRIPTS. THIS IS A FREE TOOL FOR TESTING PURPOSES ONLY. DO NOT RUN IN A PRODUCTION ENVIRONMENT.###