Windows API reference
NtSetContextThread
Sets the register context, including the instruction pointer, of a specified thread; the native equivalent of SetThreadContext.
- Library
- Ntdll.dll
- Category
- Injection, Process Hollowing
- Suspicion
- high
Detection summary
Used to redirect a suspended thread RIP to shellcode (thread execution hijacking) or to set the entry point of a hollowed image; detect ETW-TI context-change events, SuspendThread/SetThreadContext/ResumeThread sequences, a new RIP in private executable memory, and Sysmon 25 for image tampering. There is no direct Sysmon event for context changes.
- Sysmon: No Sysmon event mapped
- ETW: Microsoft-Windows-Threat-Intelligence
- Notes: Sysmon does not log SetThreadContext; Sysmon 25 may correlate only when image tampering is detected. Debuggers also use this API heavily.
Sources and documentation
- Microsoft Learn documentation (equivalent API documentation)
Not yet human-reviewed. Page metadata generated .
Legitimate use
Debuggers, crash handlers and security tools that set thread context.
Related APIs
- SetThreadContext — Kernel32.dll