NtCreateMutant
Creates or opens a named or unnamed mutant (mutex) object and optionally takes initial ownership.
Prototype
NTSTATUS NtCreateMutant( PHANDLE MutantHandle, ACCESS_MASK DesiredAccess, POBJECT_ATTRIBUTES ObjectAttributes, BOOLEAN InitialOwner );
Arguments
| Name | Type | Dir | Description |
|---|---|---|---|
| MutantHandle | PHANDLE | out | Receives the handle to the new mutant on success. |
| DesiredAccess | ACCESS_MASK | in | Access mask, typically MUTANT_ALL_ACCESS or MUTANT_QUERY_STATE | SYNCHRONIZE. |
| ObjectAttributes | POBJECT_ATTRIBUTES | in | Optional object attributes; NULL for unnamed, supply a name under \BaseNamedObjects for cross-process IPC. |
| InitialOwner | BOOLEAN | in | TRUE makes the calling thread the initial owner (recursion count = 1, non-signaled). |
Syscall IDs by Windows version
| Windows version | Syscall ID | Build |
|---|---|---|
| Win10 1507 | 0xA7 | win10-1507 |
| Win10 1607 | 0xA9 | win10-1607 |
| Win10 1703 | 0xAC | win10-1703 |
| Win10 1709 | 0xAD | win10-1709 |
| Win10 1803 | 0xAE | win10-1803 |
| Win10 1809 | 0xAE | win10-1809 |
| Win10 1903 | 0xAF | win10-1903 |
| Win10 1909 | 0xAF | win10-1909 |
| Win10 2004 | 0xB3 | win10-2004 |
| Win10 20H2 | 0xB3 | win10-20h2 |
| Win10 21H1 | 0xB3 | win10-21h1 |
| Win10 21H2 | 0xB4 | win10-21h2 |
| Win10 22H2 | 0xB4 | win10-22h2 |
| Win11 21H2 | 0xB7 | win11-21h2 |
| Win11 22H2 | 0xB8 | win11-22h2 |
| Win11 23H2 | 0xB8 | win11-23h2 |
| Win11 24H2 | 0xBA | win11-24h2 |
| Server 2016 | 0xA9 | winserver-2016 |
| Server 2019 | 0xAE | winserver-2019 |
| Server 2022 | 0xB6 | winserver-2022 |
| Server 2025 | 0xBA | winserver-2025 |
Kernel module
Related APIs
Syscall stub
4C 8B D1 mov r10, rcx B8 BA 00 00 00 mov eax, 0xBA 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
Backed by `KeInitializeMutant` inside ntoskrnl.exe. Unlike events, the SSN *drifts* across builds (`0xA7` on 1507 up to `0xBA` on Win11 24H2 / Server 2025), so any direct-syscall implementation needs dynamic resolution. A mutant is owned by exactly one thread at a time and supports recursive acquisition; it becomes abandoned (return `STATUS_ABANDONED_WAIT_0`) if the owner thread exits without releasing — a crash-resilient IPC property. The Win32 `CreateMutex` family ultimately calls this routine.
Common malware usage
Single-instance enforcement is the canonical use: at startup the implant calls `NtCreateMutant` with a hardcoded or hash-derived name; if `GetLastError == ERROR_ALREADY_EXISTS` (or in NT terms `STATUS_OBJECT_NAME_COLLISION`), an existing instance is running and the new one exits. Public IOC catalogs (Emotet, TrickBot, Qakbot, IcedID, NotPetya, Ryuk, Conti) include hundreds of family-specific mutex names for exactly this reason. Secondary use is intra-process lock primitive between worker modules, and as a sandbox probe (some sandboxes pre-create known mutex names to elicit early exit).
Detection opportunities
Sysmon Event ID 1 / 11 do not capture mutex creation directly; Sysmon configurations can include `<RuleGroup>` matches on `OriginalFileName` plus correlate via ETW. The high-value telemetry is ETW `Microsoft-Windows-Kernel-Object` enabled with `Mutant` keyword, or `EvtxEcmd` parsing of Object Manager handle audits when SACLs are placed on `\BaseNamedObjects\<family-name>`. Mutex-name IOCs remain one of the cheapest, longest-lived detection avenues for commodity malware — Yara rules across memory or strings still catch most droppers.
Direct syscall examples
asmx64 direct stub (Win11 24H2)
; Direct syscall stub for NtCreateMutant (SSN 0xBA on Win11 24H2 / Server 2025)
NtCreateMutant PROC
mov r10, rcx ; syscall convention
mov eax, 0BAh ; SSN (24H2 — resolve dynamically for portability)
syscall
ret
NtCreateMutant ENDPcSingle-instance check
// Refuse to run a second copy. Family-specific mutex name kept in cleartext for clarity.
UNICODE_STRING name;
RtlInitUnicodeString(&name, L"\\BaseNamedObjects\\Global\\{8B4E4-implant-singleton}");
OBJECT_ATTRIBUTES oa;
InitializeObjectAttributes(&oa, &name, OBJ_CASE_INSENSITIVE, NULL, NULL);
HANDLE h = NULL;
NTSTATUS st = NtCreateMutant(&h, MUTANT_ALL_ACCESS, &oa, FALSE);
if (st == STATUS_OBJECT_NAME_COLLISION) { ExitProcess(0); } // already running
rustwindows-sys CreateMutexW wrapper
// Cargo: windows-sys = "0.59" (Win32_System_Threading)
use windows_sys::Win32::System::Threading::CreateMutexW;
use windows_sys::Win32::Foundation::{GetLastError, ERROR_ALREADY_EXISTS};
use windows_sys::core::w;
use std::ptr::null;
unsafe fn singleton() -> bool {
let h = CreateMutexW(null(), 0, w!("Global\\{my-implant-singleton}"));
!h.is_null() && GetLastError() != ERROR_ALREADY_EXISTS
}MITRE ATT&CK mappings
Last verified: 2026-05-20