> Windows Syscalls
ntoskrnl.exeT1480T1106T1497

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

NameTypeDirDescription
MutantHandlePHANDLEoutReceives the handle to the new mutant on success.
DesiredAccessACCESS_MASKinAccess mask, typically MUTANT_ALL_ACCESS or MUTANT_QUERY_STATE | SYNCHRONIZE.
ObjectAttributesPOBJECT_ATTRIBUTESinOptional object attributes; NULL for unnamed, supply a name under \BaseNamedObjects for cross-process IPC.
InitialOwnerBOOLEANinTRUE makes the calling thread the initial owner (recursion count = 1, non-signaled).

Syscall IDs by Windows version

Windows versionSyscall IDBuild
Win10 15070xA7win10-1507
Win10 16070xA9win10-1607
Win10 17030xACwin10-1703
Win10 17090xADwin10-1709
Win10 18030xAEwin10-1803
Win10 18090xAEwin10-1809
Win10 19030xAFwin10-1903
Win10 19090xAFwin10-1909
Win10 20040xB3win10-2004
Win10 20H20xB3win10-20h2
Win10 21H10xB3win10-21h1
Win10 21H20xB4win10-21h2
Win10 22H20xB4win10-22h2
Win11 21H20xB7win11-21h2
Win11 22H20xB8win11-22h2
Win11 23H20xB8win11-23h2
Win11 24H20xBAwin11-24h2
Server 20160xA9winserver-2016
Server 20190xAEwinserver-2019
Server 20220xB6winserver-2022
Server 20250xBAwinserver-2025

Kernel module

ntoskrnl.exeNtCreateMutant

Related APIs

CreateMutexWCreateMutexExWOpenMutexWReleaseMutexNtOpenMutantNtReleaseMutantNtQueryMutant

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 ENDP

cSingle-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