You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
2.4 KiB
54 lines
2.4 KiB
4 years ago
|
#pragma once
|
||
4 years ago
|
#include "PayLoad.h"
|
||
4 years ago
|
|
||
|
#if WINVER == 2004
|
||
|
#define VMEXIT_HANDLER_SIG "\x65\xC6\x04\x25\x6D\x00\x00\x00\x00\x48\x8B\x4C\x24\x00\x48\x8B\x54\x24\x00\xE8\x00\x00\x00\x00\xE9"
|
||
|
#define VMEXIT_HANDLER_MASK "xxxxxxxxxxxxx?xxxx?x????x"
|
||
|
#elif WINVER == 1909
|
||
|
#define VMEXIT_HANDLER_SIG "\x48\x8B\x4C\x24\x00\xEB\x07\xE8\x00\x00\x00\x00\xEB\xF2\x48\x8B\x54\x24\x00\xE8\x00\x00\x00\x00\xE9"
|
||
|
#define VMEXIT_HANDLER_MASK "xxxx?xxx????xxxxxx?x????x"
|
||
|
#elif WINVER == 1903
|
||
4 years ago
|
#define VMEXIT_HANDLER_SIG "\x48\x8B\x4C\x24\x00\xEB\x07\xE8\x00\x00\x00\x00\xEB\xF2\x48\x8B\x54\x24\x00\xE8\x00\x00\x00\x00\xE9"
|
||
|
#define VMEXIT_HANDLER_MASK "xxxx?xxx????xxxxxx?x????x"
|
||
4 years ago
|
#elif WINVER == 1809
|
||
4 years ago
|
#define VMEXIT_HANDLER_SIG "\x48\x8B\x4C\x24\x00\xEB\x07\xE8\x00\x00\x00\x00\xEB\xF2\x48\x8B\x54\x24\x00\xE8\x00\x00\x00\x00\xE9"
|
||
|
#define VMEXIT_HANDLER_MASK "xxxx?xxx????xxxxxx?x????x"
|
||
4 years ago
|
#elif WINVER == 1803
|
||
4 years ago
|
#define VMEXIT_HANDLER_SIG "\xF2\x80\x3D\xFC\x12\x46\x00\x00\x0F\x84\x00\x00\x00\x00\x48\x8B\x54\x24\x00\xE8\x00\x00\x00\x00\xE9"
|
||
|
#define VMEXIT_HANDLER_MASK "xxxxxxx?xx????xxxx?x????x"
|
||
|
#elif WINVER == 1709
|
||
|
#define VMEXIT_HANDLER_SIG "\xD0\x80\x3D\x78\x0A\x47\x00\x00\x0F\x84\x00\x00\x00\x00\x48\x8B\x54\x24\x00\xE8\x00\x00\x00\x00\xE9"
|
||
|
#define VMEXIT_HANDLER_MASK "xxxxxx??xx????xxxx?x????x"
|
||
|
#elif WINVER == 1703
|
||
4 years ago
|
#define VMEXIT_HANDLER_SIG "\xD0\x80\x3D\x74\xCC\x47\x00\x00\x0F\x84\x00\x00\x00\x00\x48\x8B\x54\x24\x00\xE8\x00\x00\x00\x00\xE9"
|
||
|
#define VMEXIT_HANDLER_MASK "xxxxxx??xx????xxxx?x????x"
|
||
4 years ago
|
#endif
|
||
|
|
||
|
static_assert(sizeof(VMEXIT_HANDLER_SIG) == sizeof(VMEXIT_HANDLER_MASK), "signature does not match mask size!");
|
||
|
static_assert(sizeof(VMEXIT_HANDLER_SIG) == 26, "signature is invalid length!");
|
||
4 years ago
|
|
||
|
//
|
||
|
// AllocBase is the base address of the extra memory allocated below where hyper-v is
|
||
|
// AllocSize is the size of the extra allocated memory... This size == module size...
|
||
|
//
|
||
4 years ago
|
VOID* MapModule(pvoyager_t VoyagerData, UINT8* ImageBase);
|
||
4 years ago
|
|
||
|
//
|
||
|
// sig scan hv.exe for vmexit call and replace the relative call (RVA) with
|
||
|
// an RVA to the vmexit handler hook (which is the golden records entry point)...
|
||
|
//
|
||
|
// returns a pointer to the original vmexit function address...
|
||
|
//
|
||
|
VOID* HookVmExit(VOID* HypervBase, VOID* HypervSize, VOID* VmExitHook);
|
||
|
|
||
|
//
|
||
4 years ago
|
// creates a structure with all the data needed to be passed to the golden record...
|
||
4 years ago
|
//
|
||
4 years ago
|
VOID MakeVoyagerData
|
||
4 years ago
|
(
|
||
4 years ago
|
pvoyager_t VoyagerData,
|
||
4 years ago
|
VOID* HypervAlloc,
|
||
|
UINT64 HypervAllocSize,
|
||
4 years ago
|
VOID* PayLoadBase,
|
||
|
UINT64 PayLoadSize
|
||
4 years ago
|
);
|