Example illustrating how to use basic encryption to obfuscate a payload in order to evade AV. Two C programs: One encrypts shellcode via RC4; The other decrypts the RC4-encrypted shellcode at runtime and executes it.
- Add your unencrypted shellcode to source file encrypt_shellcode.c and modify rc4 password if desired. If you change password, make sure you update it in encrypt_shellcode.c and execute_encrypted_shellcode.c
- Build
gcc -s encrypt_shellcode.c -o encrypt_shellcode.exeand runencrypt_shellcode.exe - Copy output from encrypt_shellcode.exe and into source file
execute_encrypted_shellcode.c - Build
gcc -s execute_encrypted_shellcode.c -o execute_encrypted_shellcode.exe - Running
execute_encrypted_shellcode.exewill decrypt and then execute the shellcode