> Windows Syscalls
ntoskrnl.exeT1542.003T1490T1542

NtDeleteBootEntry

Removes a BOOT_ENTRY from the Boot Configuration Database by ID, deleting the corresponding firmware variable on UEFI.

Prototype

NTSTATUS NtDeleteBootEntry(
  ULONG Id
);

Arguments

NameTypeDirDescription
IdULONGinBCD-assigned identifier of the boot entry to remove (the value previously returned by NtAddBootEntry or seen via NtEnumerateBootEntries).

Syscall IDs by Windows version

Windows versionSyscall IDBuild
Win10 15070xC2win10-1507
Win10 16070xC5win10-1607
Win10 17030xC8win10-1703
Win10 17090xC9win10-1709
Win10 18030xCAwin10-1803
Win10 18090xCBwin10-1809
Win10 19030xCCwin10-1903
Win10 19090xCCwin10-1909
Win10 20040xD0win10-2004
Win10 20H20xD0win10-20h2
Win10 21H10xD0win10-21h1
Win10 21H20xD1win10-21h2
Win10 22H20xD1win10-22h2
Win11 21H20xD6win11-21h2
Win11 22H20xD7win11-22h2
Win11 23H20xD7win11-23h2
Win11 24H20xD9win11-24h2
Server 20160xC5winserver-2016
Server 20190xCBwinserver-2019
Server 20220xD5winserver-2022
Server 20250xD9winserver-2025

Kernel module

ntoskrnl.exeNtDeleteBootEntry

Related APIs

BcdDeleteObject (bcd.dll)bcdedit.exe /deleteSetFirmwareEnvironmentVariableW (with size 0)NtAddBootEntryNtModifyBootEntryNtEnumerateBootEntries

Syscall stub

4C 8B D1            mov r10, rcx
B8 D9 00 00 00      mov eax, 0xD9
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

Single-argument syscall — just the BCD ID. Maps to `BcdDeleteObject` in user mode and to `bcdedit /delete {GUID}` on the command line. Requires SeSystemEnvironmentPrivilege. On UEFI the kernel issues an `EFI_SET_VARIABLE` with `DataSize = 0` against the matching `Boot####` NVRAM variable, which is the firmware-defined deletion semantic.

Common malware usage

Bootkits use NtDeleteBootEntry for **forensic cleanup** and **anti-recovery**. Forensic cleanup: after using a temporary boot entry to flash a UEFI implant (the LoJax / MosaicRegressor pattern), delete the helper entry so a post-incident `bcdedit /enum FIRMWARE` shows nothing. Anti-recovery: ransomware (notoriously a TrickBoot-derived stage) deletes the `{recovery}` and Windows RE entries so victims cannot boot WinRE to restore from VSS or repair MBR/GPT. Wipers go further and delete `{bootmgr}` itself to brick the host post-encryption.

Detection opportunities

ETW Microsoft-Windows-Kernel-Boot is the primary source; the deletion event identifies the removed GUID. Combine with a periodic enumeration snapshot — if an entry present in last night's `bcdedit /enum FIRMWARE` is absent today **without** a corresponding admin action ticket, that is a high-confidence alert. The deletion of `{default}`, `{bootmgr}` or any `{recovery*}` GUID should be treated as a destructive-attack indicator (BCDEdit ransomware playbook) and trigger an immediate VSS/backup integrity check.

Direct syscall examples

asmx64 direct stub (Win11 24H2, SSN 0xD9)

NtDeleteBootEntry PROC
    mov  r10, rcx          ; ULONG Id
    mov  eax, 0D9h         ; Win11 24H2
    syscall
    ret
NtDeleteBootEntry ENDP

cAnti-recovery sweep (DO NOT RUN)

// Mirrors what ransomware does after encryption to prevent WinRE-based recovery.
// Public defensive analysis only.
NTSTATUS sweep_recovery(void) {
    // IDs harvested from NtEnumerateBootEntries; filter on FriendlyName == "Windows Recovery Environment".
    ULONG recovery_ids[] = { 0x10, 0x11 };
    for (size_t i = 0; i < ARRAYSIZE(recovery_ids); ++i) {
        NTSTATUS s = NtDeleteBootEntry(recovery_ids[i]);
        if (!NT_SUCCESS(s)) return s;
    }
    return STATUS_SUCCESS;
}

rustNaked stub

use std::arch::asm;

#[unsafe(naked)]
unsafe extern "system" fn nt_delete_boot_entry(_id: u32) -> i32 {
    asm!(
        "mov r10, rcx",
        "mov eax, 0xD9",   // Win11 24H2
        "syscall",
        "ret",
        options(noreturn),
    );
}

MITRE ATT&CK mappings

Last verified: 2026-05-20