NtTerminateThread
Terminates the specified thread with the supplied exit status. NULL handle terminates the current thread.
Prototype
NTSTATUS NtTerminateThread( HANDLE ThreadHandle, NTSTATUS ExitStatus );
Arguments
| Name | Type | Dir | Description |
|---|---|---|---|
| ThreadHandle | HANDLE | in | Handle to the thread to terminate. NULL means the current thread. |
| ExitStatus | NTSTATUS | in | NTSTATUS exit code recorded against the thread. |
Syscall IDs by Windows version
| Windows version | Syscall ID | Build |
|---|---|---|
| Win10 1507 | 0x53 | win10-1507 |
| Win10 1607 | 0x53 | win10-1607 |
| Win10 1703 | 0x53 | win10-1703 |
| Win10 1709 | 0x53 | win10-1709 |
| Win10 1803 | 0x53 | win10-1803 |
| Win10 1809 | 0x53 | win10-1809 |
| Win10 1903 | 0x53 | win10-1903 |
| Win10 1909 | 0x53 | win10-1909 |
| Win10 2004 | 0x53 | win10-2004 |
| Win10 20H2 | 0x53 | win10-20h2 |
| Win10 21H1 | 0x53 | win10-21h1 |
| Win10 21H2 | 0x53 | win10-21h2 |
| Win10 22H2 | 0x53 | win10-22h2 |
| Win11 21H2 | 0x53 | win11-21h2 |
| Win11 22H2 | 0x53 | win11-22h2 |
| Win11 23H2 | 0x53 | win11-23h2 |
| Win11 24H2 | 0x53 | win11-24h2 |
| Server 2016 | 0x53 | winserver-2016 |
| Server 2019 | 0x53 | winserver-2019 |
| Server 2022 | 0x53 | winserver-2022 |
| Server 2025 | 0x53 | winserver-2025 |
Kernel module
Related APIs
Syscall stub
4C 8B D1 mov r10, rcx B8 53 00 00 00 mov eax, 0x53 F6 04 25 08 03 FE 7F 01 test byte ptr [0x7FFE0308], 1 75 03 jne short +3 0F 05 syscall C3 ret CD 2E int 2Eh C3 ret
Undocumented notes
Pleasantly stable SSN — 0x53 from Windows 10 1507 through Windows 11 24H2 — because NtTerminateThread sits early in the alphabetical SSDT and few preceding routines have been added. The kernel implementation funnels through PsTerminateThreadByPointer, decrements the rundown reference, signals waiters, and ultimately reaps the thread object. When called with a NULL handle the kernel substitutes the current thread (ZwCurrentThread / (HANDLE)-2 semantics).
Common malware usage
Three classic patterns. (1) Race-stopping: terminate an EDR scan thread mid-scan so a write to disk completes before re-scan. (2) Stub cleanup: after hijacking a thread (NtSetContextThread to shellcode), the payload eventually calls NtTerminateThread(NULL, 0) to discard the hijacked thread without invoking the now-corrupted return chain. (3) Suicide on tamper detection: many crypters call NtTerminateThread on themselves the moment they detect an attached debugger to deny the analyst a live process. Often paired with NtTerminateProcess for a full self-wipe.
Detection opportunities
Self-termination is invisible noise. Cross-process termination of *another* process's thread is rare and high-signal — most legitimate code calls NtTerminateProcess instead. Capture via Microsoft-Windows-Threat-Intelligence ETW (EtwTiLogTerminateThread on some builds) or a PsSetCreateThreadNotifyRoutine watching for unusual TerminationStatus values from non-system PIDs. On modern Windows the most useful signal is *correlation*: cross-process NtOpenThread followed within milliseconds by NtTerminateThread targeting a security product PID.
Direct syscall examples
asmx64 stub (stable across builds)
; SSN 0x53 — stable Win10 1507 .. Win11 24H2.
NtTerminateThread PROC
mov r10, rcx
mov eax, 53h
syscall
ret
NtTerminateThread ENDPcSelf-terminate after payload
// At the tail of injected shellcode: cleanly exit the hijacked thread so the
// stack/return-address damage from the hijack never executes.
static VOID PayloadEpilogue(VOID) {
// ... shellcode work ...
typedef NTSTATUS (NTAPI *pNtTerminateThread)(HANDLE, NTSTATUS);
pNtTerminateThread NtTerm = (pNtTerminateThread)
GetProcAddress(GetModuleHandleA("ntdll.dll"), "NtTerminateThread");
NtTerm(NULL, 0); // NULL = current thread
}rustDirect syscall, current thread
use std::arch::asm;
#[inline(never)]
unsafe fn nt_terminate_current_thread() -> ! {
asm!(
"mov r10, rcx",
"mov eax, 0x53",
"syscall",
in("rcx") 0usize, // ThreadHandle = NULL -> current
in("rdx") 0usize, // ExitStatus = 0
options(noreturn),
);
}MITRE ATT&CK mappings
Last verified: 2026-05-20