HyperDbg Debugger
|
Header for attaching and detaching for debugging user-mode processes. More...
Go to the source code of this file.
Classes | |
struct | _USERMODE_DEBUGGING_PROCESS_DETAILS |
Description of each active thread in user-mode attaching mechanism. More... | |
Macros | |
#define | MAX_USER_ACTIONS_FOR_THREADS 3 |
Maximum actions in paused threads storage. | |
#define | MAX_THREADS_IN_A_PROCESS_HOLDER 100 |
Maximum threads that a process thread holder might have. | |
#define | MAX_CR3_IN_A_PROCESS 4 |
Maximum number of CR3 registers that a process can have. | |
Typedefs | |
typedef struct _USERMODE_DEBUGGING_PROCESS_DETAILS | USERMODE_DEBUGGING_PROCESS_DETAILS |
Description of each active thread in user-mode attaching mechanism. | |
typedef struct _USERMODE_DEBUGGING_PROCESS_DETAILS * | PUSERMODE_DEBUGGING_PROCESS_DETAILS |
Functions | |
BOOLEAN | AttachingInitialize () |
Initialize the attaching mechanism. | |
BOOLEAN | AttachingCheckPageFaultsWithUserDebugger (UINT32 CoreId, UINT64 Address, UINT32 PageFaultErrorCode) |
Check page-faults with user-debugger. | |
BOOLEAN | AttachingConfigureInterceptingThreads (UINT64 ProcessDebuggingToken, BOOLEAN Enable) |
Enable or disable the thread intercepting phase. | |
BOOLEAN | AttachingHandleCr3VmexitsForThreadInterception (UINT32 CoreId, CR3_TYPE NewCr3) |
Handle the cr3 vm-exits for thread interception. | |
VOID | AttachingTargetProcess (PDEBUGGER_ATTACH_DETACH_USER_MODE_PROCESS Request) |
Dispatch and perform attaching tasks. | |
VOID | AttachingHandleEntrypointInterception (PROCESSOR_DEBUGGING_STATE *DbgState) |
Handle the interception of finding the entrypoint on attaching to user-mode process. | |
VOID | AttachingRemoveAndFreeAllProcessDebuggingDetails () |
Remove and deallocate all thread debuggig details. | |
PUSERMODE_DEBUGGING_PROCESS_DETAILS | AttachingFindProcessDebuggingDetailsByToken (UINT64 Token) |
Find user-mode debugging details for threads by token. | |
PUSERMODE_DEBUGGING_PROCESS_DETAILS | AttachingFindProcessDebuggingDetailsByProcessId (UINT32 ProcessId) |
Find user-mode debugging details for threads by process Id. | |
BOOLEAN | AttachingQueryDetailsOfActiveDebuggingThreadsAndProcesses (PVOID BufferToStoreDetails, UINT32 BufferSize) |
Query details of active debugging threads. | |
BOOLEAN | AttachingCheckUnhandledEptViolation (UINT32 CoreId, UINT64 ViolationQualification, UINT64 GuestPhysicalAddr) |
handling unhandled EPT violations | |
BOOLEAN | AttachingReachedToValidLoadedModule (PROCESSOR_DEBUGGING_STATE *DbgState, PUSERMODE_DEBUGGING_PROCESS_DETAILS ProcessDebuggingDetail) |
Handle cases where we reached to the valid loaded module The main module should be loaded once we reach to this function. | |
Header for attaching and detaching for debugging user-mode processes.
#define MAX_CR3_IN_A_PROCESS 4 |
Maximum number of CR3 registers that a process can have.
Generally, a process has one cr3 but after meltdown KPTI another Cr3 is added and separated the kernel and user CR3s, recently I've noticed from a tweet from Petr Benes that there might be other cr3s https://twitter.com/PetrBenes/status/1310642455352672257?s=20 So, I assume two extra cr3 for each process
#define MAX_THREADS_IN_A_PROCESS_HOLDER 100 |
Maximum threads that a process thread holder might have.
#define MAX_USER_ACTIONS_FOR_THREADS 3 |
Maximum actions in paused threads storage.
typedef struct _USERMODE_DEBUGGING_PROCESS_DETAILS * PUSERMODE_DEBUGGING_PROCESS_DETAILS |
Description of each active thread in user-mode attaching mechanism.
BOOLEAN AttachingCheckPageFaultsWithUserDebugger | ( | UINT32 | CoreId, |
UINT64 | Address, | ||
UINT32 | PageFaultErrorCode ) |
Check page-faults with user-debugger.
CoreId | |
Address | |
PageFaultErrorCode |
BOOLEAN AttachingCheckUnhandledEptViolation | ( | UINT32 | CoreId, |
UINT64 | ViolationQualification, | ||
UINT64 | GuestPhysicalAddr ) |
handling unhandled EPT violations
CoreId | |
ViolationQualification | |
GuestPhysicalAddr |
Enable or disable the thread intercepting phase.
this function should be called in vmx non-root
ProcessDebuggingToken | |
Enable |
PUSERMODE_DEBUGGING_PROCESS_DETAILS AttachingFindProcessDebuggingDetailsByProcessId | ( | UINT32 | ProcessId | ) |
Find user-mode debugging details for threads by process Id.
ProcessId |
PUSERMODE_DEBUGGING_PROCESS_DETAILS AttachingFindProcessDebuggingDetailsByToken | ( | UINT64 | Token | ) |
Find user-mode debugging details for threads by token.
Token |
Handle the cr3 vm-exits for thread interception.
this function should be called in vmx-root
CoreId | |
NewCr3 |
VOID AttachingHandleEntrypointInterception | ( | PROCESSOR_DEBUGGING_STATE * | DbgState | ) |
Handle the interception of finding the entrypoint on attaching to user-mode process.
DbgState | The state of the debugger on the current core |
BOOLEAN AttachingInitialize | ( | ) |
Initialize the attaching mechanism.
as we use the functionalities for these functions, we initialize them from the debugger at start up of debugger (not initialization of user-debugger)
BOOLEAN AttachingQueryDetailsOfActiveDebuggingThreadsAndProcesses | ( | PVOID | BufferToStoreDetails, |
UINT32 | BufferSize ) |
Query details of active debugging threads.
BufferToStoreDetails | |
BufferSize |
BOOLEAN AttachingReachedToValidLoadedModule | ( | PROCESSOR_DEBUGGING_STATE * | DbgState, |
PUSERMODE_DEBUGGING_PROCESS_DETAILS | ProcessDebuggingDetail ) |
Handle cases where we reached to the valid loaded module The main module should be loaded once we reach to this function.
DbgState | The state of the debugger on the current core |
ProcessDebuggingDetail |
VOID AttachingRemoveAndFreeAllProcessDebuggingDetails | ( | ) |
Remove and deallocate all thread debuggig details.
VOID AttachingTargetProcess | ( | PDEBUGGER_ATTACH_DETACH_USER_MODE_PROCESS | Request | ) |
Dispatch and perform attaching tasks.
this function should not be called in vmx-root
AttachRequest |