Writing a custom Meterpreter encoder/decoder in C

To circumvent the security controls at the target, we will make use of custom encoding schemes, say XOR encoding, followed by one or two other encodings. Additionally, we will not use the conventional PE/COFF format and instead we will generate shellcode to work things around. Let's use msfvenom in a similar way as we did previously for the PE format. However, we will change the output format to C, as shown in the following screenshot:

Viewing the contents of the Sample.c file, we have the following:

Since we have the shellcode ready, we will build an encoder in C, which will XOR encode the ...

Get Mastering Metasploit - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.