NtSetEvent
Sets an event object to the signaled state, releasing waiting threads.
Prototype
NTSTATUS NtSetEvent( HANDLE EventHandle, PLONG PreviousState );
Arguments
| Name | Type | Dir | Description |
|---|---|---|---|
| EventHandle | HANDLE | in | Handle to the event with EVENT_MODIFY_STATE access. |
| PreviousState | PLONG | out | Optional; receives the prior signaled state (1 = was signaled, 0 = was non-signaled). |
Syscall IDs by Windows version
| Windows version | Syscall ID | Build |
|---|---|---|
| Win10 1507 | 0xE | win10-1507 |
| Win10 1607 | 0xE | win10-1607 |
| Win10 1703 | 0xE | win10-1703 |
| Win10 1709 | 0xE | win10-1709 |
| Win10 1803 | 0xE | win10-1803 |
| Win10 1809 | 0xE | win10-1809 |
| Win10 1903 | 0xE | win10-1903 |
| Win10 1909 | 0xE | win10-1909 |
| Win10 2004 | 0xE | win10-2004 |
| Win10 20H2 | 0xE | win10-20h2 |
| Win10 21H1 | 0xE | win10-21h1 |
| Win10 21H2 | 0xE | win10-21h2 |
| Win10 22H2 | 0xE | win10-22h2 |
| Win11 21H2 | 0xE | win11-21h2 |
| Win11 22H2 | 0xE | win11-22h2 |
| Win11 23H2 | 0xE | win11-23h2 |
| Win11 24H2 | 0xE | win11-24h2 |
| Server 2016 | 0xE | winserver-2016 |
| Server 2019 | 0xE | winserver-2019 |
| Server 2022 | 0xE | winserver-2022 |
| Server 2025 | 0xE | winserver-2025 |
Kernel module
Related APIs
Syscall stub
4C 8B D1 mov r10, rcx B8 0E 00 00 00 mov eax, 0xE 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
Transitions the event object to the signaled state via `KeSetEvent` inside ntoskrnl.exe. SSN `0x0E` has been stable across every Win10/11 build. For a `SynchronizationEvent` (auto-reset) exactly one waiting thread is released and the event immediately returns to non-signaled; for a `NotificationEvent` (manual reset) all current and future waiters pass through until `NtClearEvent` / `NtResetEvent` is called. Very cheap — typically a few hundred cycles when no waiter needs to be unblocked.
Common malware usage
The trigger half of the sleep-mask pattern: the timer APC routine in Ekko-style chains calls `NtSetEvent` to wake the implant thread out of its alertable wait at each ROP-chain stage (encrypt → sleep → decrypt → resume). In named-pipe C2 designs the producer signals the event after writing to the pipe so the consumer skips a polling loop. Some loaders also signal a kill-switch event to coordinate clean teardown across modules.
Detection opportunities
`NtSetEvent` on its own is unlogged and ubiquitous. Useful detection is contextual: the *pair* of `NtSetEvent` followed within microseconds by `NtWaitForSingleObject` (alertable) on the same handle, performed in a thread whose code RIP sits in private RWX memory, is a near-pathognomonic fingerprint of in-process sleep masking. ETW Threat Intelligence does not emit a dedicated event for SetEvent, so kernel-level handle-correlation or memory-region inspection at sleep boundaries is the realistic path.
Direct syscall examples
asmx64 direct stub
; Direct syscall stub for NtSetEvent (SSN 0x0E, stable across Win10/11)
NtSetEvent PROC
mov r10, rcx ; syscall convention
mov eax, 0Eh ; SSN
syscall
ret
NtSetEvent ENDPcTimer-APC sleep-mask trigger
// APC routine attached to an NtSetTimer; signals the wake-up event for the implant.
VOID NTAPI EkkoTimerApc(PVOID ctx, ULONG lo, ULONG hi) {
(void)lo; (void)hi;
HANDLE hEvent = (HANDLE)ctx;
NtSetEvent(hEvent, NULL); // wakes the alertable WaitForSingleObject in main thread
}rustwindows-sys SetEvent wrapper
// Cargo: windows-sys = "0.59" (Win32_System_Threading)
use windows_sys::Win32::Foundation::HANDLE;
use windows_sys::Win32::System::Threading::SetEvent;
unsafe fn signal(h: HANDLE) -> bool {
SetEvent(h) != 0
}MITRE ATT&CK mappings
Last verified: 2026-05-20