You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/README.md
+34-35Lines changed: 34 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,14 @@
1
1
2
-
# 'Logicgate', a User-Mode Rootkit
2
+
# 'REACT' a user-mode rootkit, RAT, and ransomware
3
3
_This article is still a WIP._
4
4
5
5
_Disclaimer: This project was made for educational and ethical purposes. This article was written
6
6
to inform computer users, Software Engineers, Cybersecurity Analysts, and others about how someone can exploit
7
7
multiple vulnerabilities to create a sophisticated piece of malware, and my explanation on how to prevent these vulnerabilities._
8
8
9
9
## Summary
10
-
This project is a remote access trojan that uses both TCP and UDP sockets for communication.
11
-
The payload is inside of a DLL that impersonates Microsofts
10
+
This project is a remote access Trojan-ransomware that uses both TCP and UDP sockets for communication.
11
+
The payload is inside of a DLL that impersonates Microsoft's
12
12
legitimate "mlang.dll" to bypass UAC and escalate privileges when paired with
13
13
a System32 mock directory alongside DLL hijacking.
14
14
@@ -22,15 +22,16 @@ Afterwards, the client establishes a connection with the C2 server over TCP and
22
22
sends its Windows machine globally unique identifier.
23
23
The server attempts to read any client save data if the client was previously
24
24
connected to the server by parsing a JSON save file and using this machine GUID as the key.
25
-
This means that Client information can be saved. For example, a client's RSA private key
26
-
can decrypt incoming requests on the server. This enforces consistency and ensures that
27
-
anything encrypted with a Client public key is not lost when the C2 server or client disconnects.
25
+
This means that Client information can be saved. For example, a client's RSA private key
26
+
such as the RSA public and private key pair.
27
+
This enforces consistency and ensures that
28
+
anything encrypted with is not lost when the C2 server or client disconnects.
28
29
In conclusion, any crucial data is stored from a client and loaded on join.
29
30
If not, the server saves the data to the JSON file.
30
31
31
32
The server can request the client to perform actions on the remote host, and the
32
-
client responds with details regarding this. An RSA key pair is used for encrypted
33
-
communication and to encrypt and decrypt files on the remote host.
33
+
client responds with details regarding this. Hybrid encryption is used. An AES key is exchanged
34
+
alongside client and server RSA public keys.
34
35
35
36
This write-up explains my experience making this project.
36
37
@@ -57,30 +58,28 @@ Still thinking about this idea of sophisticated ransomware, I realized I hadn't
57
58
another project on my GitHub where I decrypted Chrome and Firefox cookies](https://github.com/provrb/web-hacker), passwords, history, etc, using AES, Base64, and managing SQL
58
59
Databases. The idea of encrypting files with a key that couldn't be reverse-engineered stumped me until I researched further into cryptography about RSA encryption.
59
60
60
-
You see, AES encryption is a symmetrical-based encryption method, meaning the key that encrypts their files
61
-
could also decrypt those files. This didn't seem like much of a problem until I remembered this key that can encrypt AND decrypt their files would
62
-
have to be on their computer at some point. This makes this 'sophisticated' ransomware not so sophisticated, as it would be easily susceptible
63
-
to reverse engineering for the key to decrypt all the files.
64
-
65
-
The solution? An ASYMMETRICAL encryption method. In particular, RSA encryption. Rather than having one key that
66
-
can decrypt and encrypt, you have a public key that can only encrypt and a private key used to decrypt. Using this method, along with the RAT
67
-
idea, I realized I thought of an idea. In this RAT-Ransomware breed, the public and private RSA keys would be generated uniquely for each client
68
-
connection to the C2 server, the public key would then be sent to the client and the ransomware would use that RSA key to encrypt all the files
69
-
on the client.
70
-
71
-
So basically, I thought of a way to encrypt the victims' files in a reverse engineer-proof way because the key to decrypt
72
-
the files would never actually be on the victims' computers until the ransom was paid. Anything involving keys would be done on the C2 server
73
-
to keep information confidential.
74
-
75
-
Here's a bit better description:
76
-
-> Client connects to C2 server
77
-
-> C2 server generates public and private RSA key pairs and sends the public key to the client
78
-
-> Client receives the public key and encrypts all the files
79
-
[ Because you can't decrypt with the public key, it doesn't matter if the public key is ever on the victims' machine ]
80
-
-> Client pays the ransom, C2 server verifies it has been paid
81
-
-> C2 server sends the client the private key to decrypt all their files
82
-
83
-
This idea allowed me to overcome my first obstacle of securely encrypting and decrypting files without worrying about being reverse-engineered.
61
+
There is such thing as symmetrical and asymmetrical encryption algorithms. An example of symmetrical encryption would be the popular
62
+
AES algorithm, while an example of asymmetrical encryption would be RSA.
63
+
Symmetrical cryptography algorithms work to generate a key of a set size that can both decrypt and encrypt data. Asymmetrical cryptography algorithms
64
+
work to generate a pair of keys, one 'private' and one 'public' where the public key is used to encrypt data and the private key is used to decrypt encrypted data.
65
+
However, RSA encryption does have limitations when it comes to this scenario, and that is the size of the data to encrypt cannot be bigger
66
+
than the key size in bytes. For example, RSA 1024 bit keys can only encrypt 128 bytes of data at a time.
67
+
Since my Packets are 8kb in size, RSA won't work to encrypt them, so a much more complicated scheme is required.
68
+
69
+
An RSA key pair is generated when the server starts, these will be the encryption keys for the session. An AES key is
70
+
generated each time a client connects on the server. On the client, another RSA key pair is generated. Once connected,
71
+
the client and server handshake to exchange information such as the clients RSA public key, the servers RSA public key and finally
72
+
the AES key which is sent from the server, encrypted with the clients public key, and then decrypted by the client with its private key.
73
+
AES is particularly useful for sending encrypted requests and encrypting files as there are no size limitations.
74
+
This approach is called hybrid encryption, the process of combining asymmetrical encryption algorithm RSA, and symmetrical
75
+
encryption algorithm AES to securely protect data as well as secret keys. This approach is especially useful when encrypting files.
76
+
To encrypt a file, I would generate a unique AES key for the file, encrypt the file using the AES key, encrypt the AES key with an RSA public key sent
77
+
from the server and append the encrypted AES key to the file as well as the IV (initialization vector).
78
+
79
+
In conclusion, I successfully implemented a robust file encryption process utilizing hybrid encryption,
80
+
ensuring that only the appropriate decryption function can recover the data when provided with the necessary private key.
81
+
While this discussion is purely hypothetical, the described mechanism demonstrates the strength of combining RSA for secure key exchange and AES for efficient bulk encryption.
82
+
Such encryption schemes are widely applicable for secure data protection but also highlight the potential misuse of cryptography, as seen in ransomware scenarios.
84
83
85
84
## File format
86
85
After brainstorming and thinking about all these methods, I proposed myself with the question; Which file format would I want to approach this project with?
@@ -147,8 +146,8 @@ By making our DLL's export table identical to the authentic MLANG.dll, the execu
147
146
When the real ComputerDefaults.exe is executed, it would auto-elevate my DLL to Administrator privileges, bypassing the Windows UAC,
148
147
and allowing me to run malicious code in the context of an Administrator.
149
148
150
-
## Procutils.h
151
-
One of the first things I started to work on after dllmain.cpp was finished, was the procutils library. Here I created an interface for
149
+
## Process Manager
150
+
One of the first things I started to work on after dllmain.cpp was finished, was the Process Manager library. Here I created an interface for
152
151
loading different functions by getting the current processes PEB address and iterating over each LIST_ENTRY of the module
153
152
list until I found the library I was looking for. This would allow me to dynamically load libraries but, I would still need
154
153
to get the function address to actually import functions from the library. I started to research this area and found
@@ -193,7 +192,7 @@ file and were greeted with a message like "You require permission from Trusted I
193
192
like you, but it has the highest permissions available in user mode, higher than the previous group, SYSTEM. Windows has this group built-in to prevent damaging important
194
193
system files. My hypothesis: Is it possible to elevate to Trusted Installer privileges, considering how easy it was to obtain Administrator and SYSTEM privileges?
195
194
196
-
During this procedure, I used two main functions from the procutils header file. In particular, StartWindowsService and CreateProcessAccessToken use the same
195
+
During this procedure, I used two main functions from the ProcessManager header file. In particular, StartWindowsService and CreateProcessAccessToken use the same
197
196
function to obtain a SYSTEM token. You may see where this is going.
198
197
199
198
Rather than being an actual running process like winlogon.exe, TrustedInstaller is embedded into Windows as a service and thus has to be started.
0 commit comments