Payload protection – cryptography for obfuscation
As mentioned in Chapter 8, cryptographic algorithms can also be used to encrypt and decrypt payloads.
But in this section, I want to share a useful trick regarding how you can try to automate the process of payload obfuscation. Of course, you can use popular tools such as msfvenom
(Metasploit framework), but let’s do it ourselves. It will be easier to understand what we are doing in practice.
Practical example
Let’s look at another example. In this section, we’ll create a template for a classic payload injection example, as shown in this book’s GitHub repository: https://github.com/PacktPublishing/Malware-Development-for-Ethical-Hackers/blob/main/chapter11/03-payload-obfuscation-automation/temp.c.
This C code serves as a template for classic payload injection. It opens a specified process, decrypts and injects a payload into its memory, and then starts a remote thread to execute the injected...