HyperDbg Debugger
Loading...
Searching...
No Matches
Configuration.c File Reference

Configuration interface for hypervisor events. More...

#include "pch.h"

Functions

VOID ConfigureEnableMovToCr3ExitingOnAllProcessors ()
 routines for debugging threads (enable mov-to-cr3 exiting)
BOOLEAN ConfigureInitializeExecTrapOnAllProcessors ()
 routines for initializing user-mode, kernel-mode exec trap
VOID ConfigureUninitializeExecTrapOnAllProcessors ()
 routines for uninitializing user-mode, kernel-mode exec trap
VOID ConfigureExecTrapApplyMbecConfiguratinFromKernelSide (UINT32 CoreId)
 Apply the MBEC configuration from the kernel side.
BOOLEAN ConfigureExecTrapAddProcessToWatchingList (UINT32 ProcessId)
 Add the target process to the watching list.
BOOLEAN ConfigureExecTrapRemoveProcessFromWatchingList (UINT32 ProcessId)
 Remove the target process from the watching list.
VOID ConfigureModeBasedExecHookUninitializeOnAllProcessors ()
 routines for initializing Mode-based execution hooks
VOID ConfigureDirtyLoggingInitializeOnAllProcessors ()
 routines for initializing dirty logging mechanism
VOID ConfigureDirtyLoggingUninitializeOnAllProcessors ()
 routines for uninitializing dirty logging mechanism
VOID ConfigureDisableMovToCr3ExitingOnAllProcessors ()
 routines for debugging threads (disable mov-to-cr3 exiting)
VOID ConfigureEnableEferSyscallEventsOnAllProcessors ()
 routines for enabling syscall hooks on all cores
VOID ConfigureDisableEferSyscallEventsOnAllProcessors ()
 routines for disabling syscall hooks on all cores
BOOLEAN ConfigureEptHookUnHookAllByHookingTag (UINT64 HookingTag)
 Remove all hooks from the hooked pages list using Hooking Tag.
BOOLEAN ConfigureEptHookUnHookSingleHookByHookingTagFromVmxRoot (UINT64 HookingTag, EPT_SINGLE_HOOK_UNHOOKING_DETAILS *TargetUnhookingDetails)
 Remove single hook from the hooked pages by the given hooking tag.
BOOLEAN ConfigureEptHookUnHookSingleAddress (UINT64 VirtualAddress, UINT64 PhysAddress, UINT32 ProcessId)
 Remove single hook from the hooked pages list and invalidate TLB.
BOOLEAN ConfigureEptHookUnHookSingleAddressFromVmxRoot (UINT64 VirtualAddress, UINT64 PhysAddress, EPT_SINGLE_HOOK_UNHOOKING_DETAILS *TargetUnhookingDetails)
 Remove single hook from the hooked pages list and invalidate TLB.
VOID ConfigureEptHookAllocateExtraHookingPagesForMemoryMonitorsAndExecEptHooks (UINT32 Count)
 Allocate (reserve) extra pages for storing details of page hooks for memory monitor and regular hidden breakpoit exec EPT hooks.
VOID ConfigureEptHookReservePreallocatedPoolsForEptHooks (UINT32 Count)
 Allocate (reserve) pages for storing EPT hooks page hooks.
BOOLEAN ConfigureEptHook (PVOID TargetAddress, UINT32 ProcessId)
 This function invokes a VMCALL to set the hook and broadcast the exiting for the breakpoints on exception bitmap.
BOOLEAN ConfigureEptHookFromVmxRoot (PVOID TargetAddress)
 This function invokes a direct VMCALL to setup the hook.
BOOLEAN ConfigureEptHook2 (UINT32 CoreId, PVOID TargetAddress, PVOID HookFunction, UINT32 ProcessId)
 This function allocates a buffer in VMX Non Root Mode and then invokes a VMCALL to set the hook (inline).
BOOLEAN ConfigureEptHookMonitor (UINT32 CoreId, EPT_HOOKS_ADDRESS_DETAILS_FOR_MEMORY_MONITOR *HookingDetails, UINT32 ProcessId)
 This function allocates a buffer in VMX Non Root Mode and then invokes a VMCALL to set the hook.
BOOLEAN ConfigureEptHook2FromVmxRoot (UINT32 CoreId, PVOID TargetAddress, PVOID HookFunction)
 This function allocates a buffer in VMX Non Root Mode and then invokes a VMCALL to set the hook (inline EPT hook).
BOOLEAN ConfigureEptHookMonitorFromVmxRoot (UINT32 CoreId, EPT_HOOKS_ADDRESS_DETAILS_FOR_MEMORY_MONITOR *MemoryAddressDetails)
 This function allocates a buffer in VMX Non Root Mode and then invokes a VMCALL to set the hook.
BOOLEAN ConfigureEptHookModifyInstructionFetchState (UINT32 CoreId, PVOID PhysicalAddress, BOOLEAN IsUnset)
 Change PML EPT state for execution (execute) @detail should be called from VMX-root.
BOOLEAN ConfigureEptHookModifyPageReadState (UINT32 CoreId, PVOID PhysicalAddress, BOOLEAN IsUnset)
 Change PML EPT state for read @detail should be called from VMX-root.
BOOLEAN ConfigureEptHookModifyPageWriteState (UINT32 CoreId, PVOID PhysicalAddress, BOOLEAN IsUnset)
 Change PML EPT state for write @detail should be called from VMX-root.
VOID ConfigureEnableEferSyscallHookOnSingleCore (UINT32 TargetCoreId)
 routines for enabling EFER syscall hooks on a single core
VOID ConfigureSetEferSyscallOrSysretHookType (DEBUGGER_EVENT_SYSCALL_SYSRET_TYPE SyscallHookType)
 routines for setting EFER syscall or sysret hooks type
VOID ConfigureSetExternalInterruptExitingOnSingleCore (UINT32 TargetCoreId)
 set external interrupt exiting on a single core
VOID ConfigureEnableRdtscExitingOnSingleCore (UINT32 TargetCoreId)
 enable RDTSC exiting on a single core
VOID ConfigureEnableRdpmcExitingOnSingleCore (UINT32 TargetCoreId)
 enable RDPMC exiting on a single core
VOID ConfigureEnableMovToDebugRegistersExitingOnSingleCore (UINT32 TargetCoreId)
 enable mov 2 debug register exiting on a single core
VOID ConfigureSetExceptionBitmapOnSingleCore (UINT32 TargetCoreId, UINT32 BitMask)
 set exception bitmap on a single core
VOID ConfigureEnableMovToControlRegisterExitingOnSingleCore (UINT32 TargetCoreId, DEBUGGER_EVENT_OPTIONS *BroadcastingOption)
 enable mov 2 control register on a single core
VOID ConfigureChangeMsrBitmapWriteOnSingleCore (UINT32 TargetCoreId, UINT64 MsrMask)
 change the mask of msr bitmaps for write on a single core
VOID ConfigureChangeMsrBitmapReadOnSingleCore (UINT32 TargetCoreId, UINT64 MsrMask)
 change the mask of msr bitmaps for read on a single core
VOID ConfigureChangeIoBitmapOnSingleCore (UINT32 TargetCoreId, UINT64 Port)
 change I/O port bitmap on a single core

Detailed Description

Configuration interface for hypervisor events.

Author
Sina Karvandi (sina@.nosp@m.hype.nosp@m.rdbg..nosp@m.org)
Version
0.2
Date
2023-01-26

Function Documentation

◆ ConfigureChangeIoBitmapOnSingleCore()

VOID ConfigureChangeIoBitmapOnSingleCore ( UINT32 TargetCoreId,
UINT64 Port )

change I/O port bitmap on a single core

Parameters
TargetCoreIdThe target core's ID (to just run on this core)
PortTarget port in I/O bitmap
Returns
VOID
571{
573}
void * PVOID
Definition BasicTypes.h:56
VOID DpcRoutinePerformChangeIoBitmapOnSingleCore(KDPC *Dpc, PVOID DeferredContext, PVOID SystemArgument1, PVOID SystemArgument2)
change I/O bitmap on a single core
Definition DpcRoutines.c:414
NTSTATUS DpcRoutineRunTaskOnSingleCore(UINT32 CoreNumber, PVOID Routine, PVOID DeferredContext)
This function synchronize the function execution for a single core You should only used it for one co...
Definition DpcRoutines.c:35

◆ ConfigureChangeMsrBitmapReadOnSingleCore()

VOID ConfigureChangeMsrBitmapReadOnSingleCore ( UINT32 TargetCoreId,
UINT64 MsrMask )

change the mask of msr bitmaps for read on a single core

Parameters
TargetCoreIdThe target core's ID (to just run on this core)
MsrMaskThe ECX in MSR (mask)
Returns
VOID
557{
559}
VOID DpcRoutinePerformChangeMsrBitmapReadOnSingleCore(KDPC *Dpc, PVOID DeferredContext, PVOID SystemArgument1, PVOID SystemArgument2)
change msr bitmap read on a single core
Definition DpcRoutines.c:156

◆ ConfigureChangeMsrBitmapWriteOnSingleCore()

VOID ConfigureChangeMsrBitmapWriteOnSingleCore ( UINT32 TargetCoreId,
UINT64 MsrMask )

change the mask of msr bitmaps for write on a single core

Parameters
TargetCoreIdThe target core's ID (to just run on this core)
MsrMaskThe ECX in MSR (mask)
Returns
VOID
543{
545}
VOID DpcRoutinePerformChangeMsrBitmapWriteOnSingleCore(KDPC *Dpc, PVOID DeferredContext, PVOID SystemArgument1, PVOID SystemArgument2)
change msr bitmap write on a single core
Definition DpcRoutines.c:184

◆ ConfigureDirtyLoggingInitializeOnAllProcessors()

VOID ConfigureDirtyLoggingInitializeOnAllProcessors ( )

routines for initializing dirty logging mechanism

Returns
VOID
102{
104}
BOOLEAN DirtyLoggingInitialize()
Initialize the dirty logging mechanism.
Definition DirtyLogging.c:21

◆ ConfigureDirtyLoggingUninitializeOnAllProcessors()

VOID ConfigureDirtyLoggingUninitializeOnAllProcessors ( )

routines for uninitializing dirty logging mechanism

Returns
VOID
113{
115}
VOID DirtyLoggingUninitialize()
Initialize the dirty logging mechanism.
Definition DirtyLogging.c:182

◆ ConfigureDisableEferSyscallEventsOnAllProcessors()

VOID ConfigureDisableEferSyscallEventsOnAllProcessors ( )

routines for disabling syscall hooks on all cores

Returns
VOID
146{
148}
IMPORT_EXPORT_VMM VOID BroadcastDisableEferSyscallEventsOnAllProcessors()
routines for disabling syscall hooks on all cores
Definition Broadcast.c:513

◆ ConfigureDisableMovToCr3ExitingOnAllProcessors()

VOID ConfigureDisableMovToCr3ExitingOnAllProcessors ( )

routines for debugging threads (disable mov-to-cr3 exiting)

Returns
VOID
124{
126}
IMPORT_EXPORT_VMM VOID BroadcastDisableMovToCr3ExitingOnAllProcessors()
routines for debugging threads (disable mov-to-cr3 exiting)
Definition Broadcast.c:491

◆ ConfigureEnableEferSyscallEventsOnAllProcessors()

VOID ConfigureEnableEferSyscallEventsOnAllProcessors ( )

routines for enabling syscall hooks on all cores

Returns
VOID
135{
137}
IMPORT_EXPORT_VMM VOID BroadcastEnableEferSyscallEventsOnAllProcessors()
routines for enabling syscall hooks on all cores
Definition Broadcast.c:502

◆ ConfigureEnableEferSyscallHookOnSingleCore()

VOID ConfigureEnableEferSyscallHookOnSingleCore ( UINT32 TargetCoreId)

routines for enabling EFER syscall hooks on a single core

Parameters
TargetCoreIdThe target core's ID (to just run on this core)
Returns
VOID
429{
431}
VOID DpcRoutinePerformEnableEferSyscallHookOnSingleCore(KDPC *Dpc, PVOID DeferredContext, PVOID SystemArgument1, PVOID SystemArgument2)
Enable syscall hook EFER on a single core.
Definition DpcRoutines.c:385

◆ ConfigureEnableMovToControlRegisterExitingOnSingleCore()

VOID ConfigureEnableMovToControlRegisterExitingOnSingleCore ( UINT32 TargetCoreId,
DEBUGGER_EVENT_OPTIONS * BroadcastingOption )

enable mov 2 control register on a single core

Parameters
TargetCoreIdThe target core's ID (to just run on this core)
BroadcastingOptionThe optional broadcasting fields
Returns
VOID
529{
531}
VOID DpcRoutinePerformEnableMovToControlRegisterExiting(KDPC *Dpc, DEBUGGER_EVENT_OPTIONS *EventOptions, PVOID SystemArgument1, PVOID SystemArgument2)
Set the Mov to Control Registers Exitings.
Definition DpcRoutines.c:328

◆ ConfigureEnableMovToCr3ExitingOnAllProcessors()

VOID ConfigureEnableMovToCr3ExitingOnAllProcessors ( )

routines for debugging threads (enable mov-to-cr3 exiting)

Returns
VOID
22{
24}
IMPORT_EXPORT_VMM VOID BroadcastEnableMovToCr3ExitingOnAllProcessors()
routines for debugging threads (enable mov-to-cr3 exiting)
Definition Broadcast.c:436

◆ ConfigureEnableMovToDebugRegistersExitingOnSingleCore()

VOID ConfigureEnableMovToDebugRegistersExitingOnSingleCore ( UINT32 TargetCoreId)

enable mov 2 debug register exiting on a single core

Parameters
TargetCoreIdThe target core's ID (to just run on this core)
Returns
VOID
501{
503}
VOID DpcRoutinePerformEnableMovToDebugRegistersExiting(KDPC *Dpc, PVOID DeferredContext, PVOID SystemArgument1, PVOID SystemArgument2)
Set the Mov to Debug Registers Exitings.
Definition DpcRoutines.c:299

◆ ConfigureEnableRdpmcExitingOnSingleCore()

VOID ConfigureEnableRdpmcExitingOnSingleCore ( UINT32 TargetCoreId)

enable RDPMC exiting on a single core

Parameters
TargetCoreIdThe target core's ID (to just run on this core)
Returns
VOID
488{
490}
VOID DpcRoutinePerformEnableRdpmcExitingOnSingleCore(KDPC *Dpc, PVOID DeferredContext, PVOID SystemArgument1, PVOID SystemArgument2)
set rdpmc exiting
Definition DpcRoutines.c:241

◆ ConfigureEnableRdtscExitingOnSingleCore()

VOID ConfigureEnableRdtscExitingOnSingleCore ( UINT32 TargetCoreId)

enable RDTSC exiting on a single core

Parameters
TargetCoreIdThe target core's ID (to just run on this core)
Returns
VOID
475{
477}
VOID DpcRoutinePerformEnableRdtscExitingOnSingleCore(KDPC *Dpc, PVOID DeferredContext, PVOID SystemArgument1, PVOID SystemArgument2)
set rdtsc/rdtscp exiting
Definition DpcRoutines.c:212

◆ ConfigureEptHook()

BOOLEAN ConfigureEptHook ( PVOID TargetAddress,
UINT32 ProcessId )

This function invokes a VMCALL to set the hook and broadcast the exiting for the breakpoints on exception bitmap.

this command uses hidden breakpoints (0xcc) to hook, THIS FUNCTION SHOULD BE CALLED WHEN THE VMLAUNCH ALREADY EXECUTED, it is because, broadcasting to enable exception bitmap for breakpoint is not clear here, if we want to broadcast to enable exception bitmaps on all cores when vmlaunch is not executed then that's ok but a user might call this function when we didn't configure the vmcs, it's a problem! we can solve it by giving a hint to vmcs configure function to make it ok for future configuration but that sounds stupid, I think it's better to not support this feature. Btw, debugger won't use this function in the above mentioned method, so we won't have any problem with this :)

Parameters
TargetAddressThe address of function or memory address to be hooked
ProcessIdThe process id to translate based on that process's cr3
Returns
BOOLEAN Returns true if the hook was successful or false if there was an error
264{
265 return EptHook(TargetAddress, ProcessId);
266}
BOOLEAN EptHook(PVOID TargetAddress, UINT32 ProcessId)
This function invokes a VMCALL to set the hook and broadcast the exiting for the breakpoints on excep...
Definition EptHook.c:620

◆ ConfigureEptHook2()

BOOLEAN ConfigureEptHook2 ( UINT32 CoreId,
PVOID TargetAddress,
PVOID HookFunction,
UINT32 ProcessId )

This function allocates a buffer in VMX Non Root Mode and then invokes a VMCALL to set the hook (inline).

this command uses hidden detours, this NOT be called from vmx-root mode

Parameters
CoreIdID of the target core
TargetAddressThe address of function or memory address to be hooked
HookFunctionThe function that will be called when hook triggered
ProcessIdThe process id to translate based on that process's cr3
Returns
BOOLEAN Returns true if the hook was successful or false if there was an error
301{
302 return EptHookInlineHook(&g_GuestState[CoreId],
303 TargetAddress,
304 HookFunction,
305 ProcessId);
306}
BOOLEAN EptHookInlineHook(VIRTUAL_MACHINE_STATE *VCpu, PVOID TargetAddress, PVOID HookFunction, UINT32 ProcessId)
This function applies EPT hook 2 (inline) to the target EPT table.
Definition EptHook.c:1562
VIRTUAL_MACHINE_STATE * g_GuestState
Save the state and variables related to virtualization on each to logical core.
Definition GlobalVariables.h:38

◆ ConfigureEptHook2FromVmxRoot()

BOOLEAN ConfigureEptHook2FromVmxRoot ( UINT32 CoreId,
PVOID TargetAddress,
PVOID HookFunction )

This function allocates a buffer in VMX Non Root Mode and then invokes a VMCALL to set the hook (inline EPT hook).

this command uses hidden detours, this should be called from vmx-root mode

Parameters
CoreIdID of the target core
TargetAddressThe address of function or memory address to be hooked
HookFunctionThe function that will be called when hook triggered
Returns
BOOLEAN Returns true if the hook was successful or false if there was an error
343{
345 TargetAddress,
346 HookFunction);
347}
BOOLEAN EptHookInlineHookFromVmxRoot(VIRTUAL_MACHINE_STATE *VCpu, PVOID TargetAddress, PVOID HookFunction)
This function applies EPT inline to the target EPT table.
Definition EptHook.c:1633

◆ ConfigureEptHookAllocateExtraHookingPagesForMemoryMonitorsAndExecEptHooks()

VOID ConfigureEptHookAllocateExtraHookingPagesForMemoryMonitorsAndExecEptHooks ( UINT32 Count)

Allocate (reserve) extra pages for storing details of page hooks for memory monitor and regular hidden breakpoit exec EPT hooks.

Parameters
Count
Returns
VOID
230{
232}
VOID EptHookAllocateExtraHookingPagesForMemoryMonitorsAndExecEptHooks(UINT32 Count)
Allocate (reserve) extra pages for storing details of page hooks for memory monitor and regular hidde...
Definition EptHook.c:110

◆ ConfigureEptHookFromVmxRoot()

BOOLEAN ConfigureEptHookFromVmxRoot ( PVOID TargetAddress)

This function invokes a direct VMCALL to setup the hook.

the caller of this function should make sure to 1) broadcast to all cores to intercept breakpoints (#BPs) and after calling this function 2) the caller should broadcast to all cores to invalidate their EPTPs

Parameters
TargetAddressThe address of function or memory address to be hooked
Returns
BOOLEAN Returns true if the hook was successful or false if there was an error
281{
282 return EptHookFromVmxRoot(TargetAddress);
283}
BOOLEAN EptHookFromVmxRoot(PVOID TargetAddress)
This function invokes a direct VMCALL to setup the hook.
Definition EptHook.c:646

◆ ConfigureEptHookModifyInstructionFetchState()

BOOLEAN ConfigureEptHookModifyInstructionFetchState ( UINT32 CoreId,
PVOID PhysicalAddress,
BOOLEAN IsUnset )

Change PML EPT state for execution (execute) @detail should be called from VMX-root.

Parameters
CoreIdCurrent Core ID
PhysicalAddressTarget physical address
IsUnsetIs unsetting bit or setting bit
Returns
BOOLEAN
380{
381 return EptHookModifyInstructionFetchState(&g_GuestState[CoreId], PhysicalAddress, IsUnset);
382}
BOOLEAN EptHookModifyInstructionFetchState(VIRTUAL_MACHINE_STATE *VCpu, PVOID PhysicalAddress, BOOLEAN IsUnset)
Change PML EPT state for execution (execute) @detail should be called from VMX-root.
Definition EptHook.c:2586

◆ ConfigureEptHookModifyPageReadState()

BOOLEAN ConfigureEptHookModifyPageReadState ( UINT32 CoreId,
PVOID PhysicalAddress,
BOOLEAN IsUnset )

Change PML EPT state for read @detail should be called from VMX-root.

Parameters
VCpuThe virtual processor's state
PhysicalAddressTarget physical address
IsUnsetIs unsetting bit or setting bit
Returns
BOOLEAN
398{
399 return EptHookModifyPageReadState(&g_GuestState[CoreId], PhysicalAddress, IsUnset);
400}
BOOLEAN EptHookModifyPageReadState(VIRTUAL_MACHINE_STATE *VCpu, PVOID PhysicalAddress, BOOLEAN IsUnset)
Change PML EPT state for read @detail should be called from VMX-root.
Definition EptHook.c:2644

◆ ConfigureEptHookModifyPageWriteState()

BOOLEAN ConfigureEptHookModifyPageWriteState ( UINT32 CoreId,
PVOID PhysicalAddress,
BOOLEAN IsUnset )

Change PML EPT state for write @detail should be called from VMX-root.

Parameters
VCpuThe virtual processor's state
PhysicalAddressTarget physical address
IsUnsetIs unsetting bit or setting bit
Returns
BOOLEAN
416{
417 return EptHookModifyPageWriteState(&g_GuestState[CoreId], PhysicalAddress, IsUnset);
418}
BOOLEAN EptHookModifyPageWriteState(VIRTUAL_MACHINE_STATE *VCpu, PVOID PhysicalAddress, BOOLEAN IsUnset)
Change PML EPT state for write @detail should be called from VMX-root.
Definition EptHook.c:2702

◆ ConfigureEptHookMonitor()

BOOLEAN ConfigureEptHookMonitor ( UINT32 CoreId,
EPT_HOOKS_ADDRESS_DETAILS_FOR_MEMORY_MONITOR * HookingDetails,
UINT32 ProcessId )

This function allocates a buffer in VMX Non Root Mode and then invokes a VMCALL to set the hook.

this command uses hidden detours, this NOT be called from vmx-root mode

Parameters
CoreIdID of the target core
HookingDetailsMonitor hooking detail
ProcessIdThe process id to translate based on that process's cr3
Returns
BOOLEAN Returns true if the hook was successful or false if there was an error
323{
324 return EptHookMonitorHook(&g_GuestState[CoreId],
325 HookingDetails,
326 ProcessId);
327}
BOOLEAN EptHookMonitorHook(VIRTUAL_MACHINE_STATE *VCpu, EPT_HOOKS_ADDRESS_DETAILS_FOR_MEMORY_MONITOR *HookingDetails, UINT32 ProcessId)
This function applies monitor hooks to the target EPT table.
Definition EptHook.c:1602

◆ ConfigureEptHookMonitorFromVmxRoot()

BOOLEAN ConfigureEptHookMonitorFromVmxRoot ( UINT32 CoreId,
EPT_HOOKS_ADDRESS_DETAILS_FOR_MEMORY_MONITOR * MemoryAddressDetails )

This function allocates a buffer in VMX Non Root Mode and then invokes a VMCALL to set the hook.

this command uses hidden detours, this should be called from vmx-root mode

Parameters
CoreIdID of the target core
MemoryAddressDetailsMonitor hooking details
Returns
BOOLEAN Returns true if the hook was successful or false if there was an error
362{
363 return EptHookMonitorFromVmxRoot(&g_GuestState[CoreId], MemoryAddressDetails);
364}
BOOLEAN EptHookMonitorFromVmxRoot(VIRTUAL_MACHINE_STATE *VCpu, EPT_HOOKS_ADDRESS_DETAILS_FOR_MEMORY_MONITOR *MemoryAddressDetails)
This function applies EPT monitor hooks to the target EPT table.
Definition EptHook.c:1671

◆ ConfigureEptHookReservePreallocatedPoolsForEptHooks()

VOID ConfigureEptHookReservePreallocatedPoolsForEptHooks ( UINT32 Count)

Allocate (reserve) pages for storing EPT hooks page hooks.

Parameters
Count
Returns
VOID
242{
244}
VOID EptHookReservePreallocatedPoolsForEptHooks(UINT32 Count)
Reserve pre-allocated pools for EPT hooks.
Definition EptHook.c:70

◆ ConfigureEptHookUnHookAllByHookingTag()

BOOLEAN ConfigureEptHookUnHookAllByHookingTag ( UINT64 HookingTag)

Remove all hooks from the hooked pages list using Hooking Tag.

Should be called from vmx non-root

Parameters
HookingTagThe hooking tag to remove all hooks
Returns
BOOLEAN If unhook was successful it returns true or if it was not successful returns false
160{
161 return EptHookUnHookAllByHookingTag(HookingTag);
162}
BOOLEAN EptHookUnHookAllByHookingTag(UINT64 HookingTag)
Remove all hooks from the hooked pages by the given hooking tag.
Definition EptHook.c:2316

◆ ConfigureEptHookUnHookSingleAddress()

BOOLEAN ConfigureEptHookUnHookSingleAddress ( UINT64 VirtualAddress,
UINT64 PhysAddress,
UINT32 ProcessId )

Remove single hook from the hooked pages list and invalidate TLB.

Should be called from vmx non-root

Parameters
VirtualAddressVirtual address to unhook
PhysAddressPhysical address to unhook (optional)
ProcessIdThe process id of target process

in unhooking for some hooks only physical address is availables

Returns
BOOLEAN If unhook was successful it returns true or if it was not successful returns false
193{
194 return EptHookUnHookSingleAddress(VirtualAddress, PhysAddress, ProcessId);
195}
BOOLEAN EptHookUnHookSingleAddress(UINT64 VirtualAddress, UINT64 PhysAddress, UINT32 ProcessId)
Remove single hook from the hooked pages list and invalidate TLB.
Definition EptHook.c:2390

◆ ConfigureEptHookUnHookSingleAddressFromVmxRoot()

BOOLEAN ConfigureEptHookUnHookSingleAddressFromVmxRoot ( UINT64 VirtualAddress,
UINT64 PhysAddress,
EPT_SINGLE_HOOK_UNHOOKING_DETAILS * TargetUnhookingDetails )

Remove single hook from the hooked pages list and invalidate TLB.

Should be called from vmx root-mode and it's the responsibility of caller to broadcast to all cores to remove the target physical address and invalidate EPT and modify exception bitmap (#BPs) if needed

Parameters
VirtualAddressVirtual address to unhook
PhysAddressPhysical address to unhook (optional)
TargetUnhookingDetailsTarget data for the caller to restore EPT entry and invalidate EPT caches. Only when applied in VMX-root mode directly
Returns
BOOLEAN If unhook was successful it returns true or if it was not successful returns false
214{
215 return EptHookUnHookSingleAddressFromVmxRoot(VirtualAddress,
216 PhysAddress,
217 TargetUnhookingDetails);
218}
BOOLEAN EptHookUnHookSingleAddressFromVmxRoot(UINT64 VirtualAddress, UINT64 PhysAddress, EPT_SINGLE_HOOK_UNHOOKING_DETAILS *TargetUnhookingDetails)
Remove single hook from the hooked pages list and invalidate TLB.
Definition EptHook.c:2424

◆ ConfigureEptHookUnHookSingleHookByHookingTagFromVmxRoot()

BOOLEAN ConfigureEptHookUnHookSingleHookByHookingTagFromVmxRoot ( UINT64 HookingTag,
EPT_SINGLE_HOOK_UNHOOKING_DETAILS * TargetUnhookingDetails )

Remove single hook from the hooked pages by the given hooking tag.

Should be called from Vmx root-mode

Parameters
HookingTagThe hooking tag to unhook
Returns
BOOLEAN If unhook was successful it returns true or if it was not successful returns false
174{
175 return EptHookUnHookSingleHookByHookingTagFromVmxRoot(HookingTag, TargetUnhookingDetails);
176}
BOOLEAN EptHookUnHookSingleHookByHookingTagFromVmxRoot(UINT64 HookingTag, EPT_SINGLE_HOOK_UNHOOKING_DETAILS *TargetUnhookingDetails)
Remove single hook from the hooked pages by the given hooking tag.
Definition EptHook.c:2359

◆ ConfigureExecTrapAddProcessToWatchingList()

BOOLEAN ConfigureExecTrapAddProcessToWatchingList ( UINT32 ProcessId)

Add the target process to the watching list.

Parameters
ProcessId
Returns
BOOLEAN
68{
69 return ExecTrapAddProcessToWatchingList(ProcessId);
70}
BOOLEAN ExecTrapAddProcessToWatchingList(UINT32 ProcessId)
Add the target process to the watching list.
Definition ExecTrap.c:790

◆ ConfigureExecTrapApplyMbecConfiguratinFromKernelSide()

VOID ConfigureExecTrapApplyMbecConfiguratinFromKernelSide ( UINT32 CoreId)

Apply the MBEC configuration from the kernel side.

Parameters
CoreIdThe core id
Returns
VOID
56{
58}
VOID ExecTrapApplyMbecConfiguratinFromKernelSide(VIRTUAL_MACHINE_STATE *VCpu)
Apply the MBEC configuration from the kernel side.
Definition ExecTrap.c:721

◆ ConfigureExecTrapRemoveProcessFromWatchingList()

BOOLEAN ConfigureExecTrapRemoveProcessFromWatchingList ( UINT32 ProcessId)

Remove the target process from the watching list.

Parameters
ProcessId
Returns
BOOLEAN
80{
82}
BOOLEAN ExecTrapRemoveProcessFromWatchingList(UINT32 ProcessId)
Remove the target process from the watching list.
Definition ExecTrap.c:815

◆ ConfigureInitializeExecTrapOnAllProcessors()

BOOLEAN ConfigureInitializeExecTrapOnAllProcessors ( )

routines for initializing user-mode, kernel-mode exec trap

Returns
BOOLEAN
33{
34 return ExecTrapInitialize();
35}
BOOLEAN ExecTrapInitialize()
Initialize the exec trap based on service request.
Definition ExecTrap.c:369

◆ ConfigureModeBasedExecHookUninitializeOnAllProcessors()

VOID ConfigureModeBasedExecHookUninitializeOnAllProcessors ( )

routines for initializing Mode-based execution hooks

Returns
VOID
91{
93}
VOID ModeBasedExecHookUninitialize()
Uinitialize the needed structure for hooking mode execution.
Definition ModeBasedExecHook.c:275

◆ ConfigureSetEferSyscallOrSysretHookType()

VOID ConfigureSetEferSyscallOrSysretHookType ( DEBUGGER_EVENT_SYSCALL_SYSRET_TYPE SyscallHookType)

routines for setting EFER syscall or sysret hooks type

Parameters
SyscallHookTypeType of hook
Returns
VOID
442{
443 if (SyscallHookType == DEBUGGER_EVENT_SYSCALL_SYSRET_HANDLE_ALL_UD)
444 {
446 }
447 else if (SyscallHookType == DEBUGGER_EVENT_SYSCALL_SYSRET_SAFE_ACCESS_MEMORY)
448 {
450 }
451}
#define TRUE
Definition BasicTypes.h:114
#define FALSE
Definition BasicTypes.h:113
@ DEBUGGER_EVENT_SYSCALL_SYSRET_SAFE_ACCESS_MEMORY
Definition Events.h:197
@ DEBUGGER_EVENT_SYSCALL_SYSRET_HANDLE_ALL_UD
Definition Events.h:198
BOOLEAN g_IsUnsafeSyscallOrSysretHandling
Shows whether the debuggee is waiting for an trap step or not.
Definition GlobalVariables.h:94

◆ ConfigureSetExceptionBitmapOnSingleCore()

VOID ConfigureSetExceptionBitmapOnSingleCore ( UINT32 TargetCoreId,
UINT32 BitMask )

set exception bitmap on a single core

Parameters
TargetCoreIdThe target core's ID (to just run on this core)
BitMaskThe bit mask of exception bitmap
Returns
VOID
515{
517}
VOID DpcRoutinePerformSetExceptionBitmapOnSingleCore(KDPC *Dpc, PVOID DeferredContext, PVOID SystemArgument1, PVOID SystemArgument2)
change exception bitmap on a single core
Definition DpcRoutines.c:270

◆ ConfigureSetExternalInterruptExitingOnSingleCore()

VOID ConfigureSetExternalInterruptExitingOnSingleCore ( UINT32 TargetCoreId)

set external interrupt exiting on a single core

Parameters
TargetCoreIdThe target core's ID (to just run on this core)
Returns
VOID
462{
464}
VOID DpcRoutinePerformSetExternalInterruptExitingOnSingleCore(KDPC *Dpc, PVOID DeferredContext, PVOID SystemArgument1, PVOID SystemArgument2)
Enable external interrupt exiting on a single core.
Definition DpcRoutines.c:356

◆ ConfigureUninitializeExecTrapOnAllProcessors()

VOID ConfigureUninitializeExecTrapOnAllProcessors ( )

routines for uninitializing user-mode, kernel-mode exec trap

Returns
VOID
44{
46}
VOID ExecTrapUninitialize()
Uinitialize the needed structure for the reversing machine.
Definition ExecTrap.c:432