|
HyperDbg Debugger
|
Attaching and detaching for debugging user-mode processes. More...
#include "pch.h"Functions | |
| BOOLEAN | AttachingInitialize () |
| Initialize the attaching mechanism. | |
| UINT64 | AttachingCreateProcessDebuggingDetails (UINT32 ProcessId, BOOLEAN Enabled, BOOLEAN Is32Bit, BOOLEAN CheckCallbackAtFirstInstruction, PEPROCESS Eprocess, UINT64 PebAddressToMonitor, UINT64 UsermodeReservedBuffer) |
| Create user-mode debugging details for threads. | |
| 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. | |
| PUSERMODE_DEBUGGING_PROCESS_DETAILS | AttachingFindProcessDebuggingDetailsInStartingPhase () |
| Find user-mode debugging details for threads that is in the start-up phase. | |
| VOID | AttachingRemoveAndFreeAllProcessDebuggingDetails () |
| Remove and deallocate all thread debuggig details. | |
| BOOLEAN | AttachingRemoveProcessDebuggingDetailsByToken (UINT64 Token) |
| Remove user-mode debugging details for threads by its token. | |
| BOOLEAN | AttachingSetStartingPhaseOfProcessDebuggingDetailsByToken (BOOLEAN Set, UINT64 Token) |
| Set the start up phase of a debugging thread buffer by its token. | |
| 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. | |
| VOID | AttachingHandleEntrypointInterception (PROCESSOR_DEBUGGING_STATE *DbgState) |
| Handle the interception of finding the entrypoint on attaching to user-mode process. | |
| BOOLEAN | AttachingAdjustNopSledBuffer (UINT64 ReservedBuffAddress, UINT32 ProcessId) |
| Allocate a nop-sled buffer. | |
| 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 | AttachingCheckForSafeCallbackRequestedInitializations (PDEBUGGER_ATTACH_DETACH_USER_MODE_PROCESS AttachRequest, UINT64 ProcessDebuggingToken) |
| This function checks whether any special initialization is needed while attaching to a process that requests a callback. | |
| BOOLEAN | AttachingPerformAttachToProcess (PDEBUGGER_ATTACH_DETACH_USER_MODE_PROCESS AttachRequest, BOOLEAN IsAttachingToEntrypoint) |
| Attach to the target process. | |
| BOOLEAN | AttachingHandleCr3VmexitsForThreadInterception (UINT32 CoreId, CR3_TYPE NewCr3) |
| Handle the cr3 vm-exits for thread interception. | |
| BOOLEAN | AttachingCheckUnhandledEptViolation (UINT32 CoreId, UINT64 ViolationQualification, UINT64 GuestPhysicalAddr) |
| handling unhandled EPT violations | |
| BOOLEAN | AttachingRemoveHooks (PDEBUGGER_ATTACH_DETACH_USER_MODE_PROCESS AttachRequest) |
| Clearing hooks after resuming the process. | |
| BOOLEAN | AttachingPauseProcess (PDEBUGGER_ATTACH_DETACH_USER_MODE_PROCESS PauseRequest) |
| Pauses the target process. | |
| BOOLEAN | AttachingKillProcess (PDEBUGGER_ATTACH_DETACH_USER_MODE_PROCESS KillRequest) |
| Kill the target process from kernel-mode. | |
| BOOLEAN | AttachingPerformDetach (PDEBUGGER_ATTACH_DETACH_USER_MODE_PROCESS DetachRequest) |
| Clearing hooks after resuming the process. | |
| BOOLEAN | AttachingSwitchProcess (PDEBUGGER_ATTACH_DETACH_USER_MODE_PROCESS SwitchRequest) |
| Switch to the target thread. | |
| BOOLEAN | AttachingQueryCountOfActiveDebuggingThreadsAndProcesses (PDEBUGGER_ATTACH_DETACH_USER_MODE_PROCESS QueryCountOfDebugThreadsRequest) |
| Query count of active debugging threads. | |
| BOOLEAN | AttachingQueryDetailsOfActiveDebuggingThreadsAndProcesses (PVOID BufferToStoreDetails, UINT32 BufferSize) |
| Query details of active debugging threads. | |
| VOID | AttachingTargetProcess (PDEBUGGER_ATTACH_DETACH_USER_MODE_PROCESS Request) |
| Dispatch and perform attaching tasks. | |
Attaching and detaching for debugging user-mode processes.
Allocate a nop-sled buffer.
| ReservedBuffAddress | |
| ProcessId |
| BOOLEAN AttachingCheckForSafeCallbackRequestedInitializations | ( | PDEBUGGER_ATTACH_DETACH_USER_MODE_PROCESS | AttachRequest, |
| UINT64 | ProcessDebuggingToken ) |
This function checks whether any special initialization is needed while attaching to a process that requests a callback.
this function should not be called in vmx-root
| AttachRequest | |
| ProcessDebuggingToken |
| 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 |
| UINT64 AttachingCreateProcessDebuggingDetails | ( | UINT32 | ProcessId, |
| BOOLEAN | Enabled, | ||
| BOOLEAN | Is32Bit, | ||
| BOOLEAN | CheckCallbackAtFirstInstruction, | ||
| PEPROCESS | Eprocess, | ||
| UINT64 | PebAddressToMonitor, | ||
| UINT64 | UsermodeReservedBuffer ) |
Create user-mode debugging details for threads.
| ProcessId | |
| Is32Bit | |
| Eprocess | |
| PebAddressToMonitor | |
| UsermodeReservedBuffer |
| 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 |
| PUSERMODE_DEBUGGING_PROCESS_DETAILS AttachingFindProcessDebuggingDetailsInStartingPhase | ( | ) |
Find user-mode debugging details for threads that is in the start-up phase.
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 AttachingKillProcess | ( | PDEBUGGER_ATTACH_DETACH_USER_MODE_PROCESS | KillRequest | ) |
Kill the target process from kernel-mode.
this function should not be called in vmx-root
| KillRequest |
| BOOLEAN AttachingPauseProcess | ( | PDEBUGGER_ATTACH_DETACH_USER_MODE_PROCESS | PauseRequest | ) |
Pauses the target process.
this function should not be called in vmx-root
| PauseRequest |
| BOOLEAN AttachingPerformAttachToProcess | ( | PDEBUGGER_ATTACH_DETACH_USER_MODE_PROCESS | AttachRequest, |
| BOOLEAN | IsAttachingToEntrypoint ) |
Attach to the target process.
this function should not be called in vmx-root
| AttachRequest | |
| IsAttachingToEntrypoint |
| BOOLEAN AttachingPerformDetach | ( | PDEBUGGER_ATTACH_DETACH_USER_MODE_PROCESS | DetachRequest | ) |
Clearing hooks after resuming the process.
this function should not be called in vmx-root
| DetachRequest |
| BOOLEAN AttachingQueryCountOfActiveDebuggingThreadsAndProcesses | ( | PDEBUGGER_ATTACH_DETACH_USER_MODE_PROCESS | QueryCountOfDebugThreadsRequest | ) |
Query count of active debugging threads.
| QueryCountOfDebugThreadsRequest |
| 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.
| BOOLEAN AttachingRemoveHooks | ( | PDEBUGGER_ATTACH_DETACH_USER_MODE_PROCESS | AttachRequest | ) |
Clearing hooks after resuming the process.
this function should not be called in vmx-root
| AttachRequest |
Remove user-mode debugging details for threads by its token.
| Token |
Set the start up phase of a debugging thread buffer by its token.
| Set | |
| Token |
| BOOLEAN AttachingSwitchProcess | ( | PDEBUGGER_ATTACH_DETACH_USER_MODE_PROCESS | SwitchRequest | ) |
Switch to the target thread.
| SwitchRequest |
| VOID AttachingTargetProcess | ( | PDEBUGGER_ATTACH_DETACH_USER_MODE_PROCESS | Request | ) |
Dispatch and perform attaching tasks.
this function should not be called in vmx-root
| AttachRequest |