> Windows Syscalls
ntoskrnl.exeT1542.001T1014T1490

NtDeleteDriverEntry

Removes a registered EFI_DRIVER_ENTRY by ID, deleting the corresponding UEFI Driver#### NVRAM variable.

Prototype

NTSTATUS NtDeleteDriverEntry(
  ULONG Id
);

Arguments

NameTypeDirDescription
IdULONGinFirmware-assigned identifier of the driver entry to remove (the value previously returned by NtAddDriverEntry).

Syscall IDs by Windows version

Windows versionSyscall IDBuild
Win10 15070xC3win10-1507
Win10 16070xC6win10-1607
Win10 17030xC9win10-1703
Win10 17090xCAwin10-1709
Win10 18030xCBwin10-1803
Win10 18090xCCwin10-1809
Win10 19030xCDwin10-1903
Win10 19090xCDwin10-1909
Win10 20040xD1win10-2004
Win10 20H20xD1win10-20h2
Win10 21H10xD1win10-21h1
Win10 21H20xD2win10-21h2
Win10 22H20xD2win10-22h2
Win11 21H20xD7win11-21h2
Win11 22H20xD8win11-22h2
Win11 23H20xD8win11-23h2
Win11 24H20xDAwin11-24h2
Server 20160xC6winserver-2016
Server 20190xCCwinserver-2019
Server 20220xD6winserver-2022
Server 20250xDAwinserver-2025

Kernel module

ntoskrnl.exeNtDeleteDriverEntry

Related APIs

SetFirmwareEnvironmentVariableW (Driver#### with size 0)NtAddDriverEntryNtModifyDriverEntryNtEnumerateDriverEntriesNtSetSystemEnvironmentValueEx (DriverOrder)

Syscall stub

4C 8B D1            mov r10, rcx
B8 DA 00 00 00      mov eax, 0xDA
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. On UEFI the kernel issues an `EFI_SET_VARIABLE` with `DataSize = 0` against the matching `Driver####` NVRAM variable, the firmware-defined deletion semantic. SeSystemEnvironmentPrivilege is required. The corresponding DriverOrder slot must be cleaned up separately via NtSetSystemEnvironmentValueEx or it will continue to reference an empty variable.

Common malware usage

Two complementary abuses. (1) **Cleanup**: after a DXE-based payload has flashed its second-stage to SPI flash or a hidden NVRAM blob, the attacker deletes the visible bootstrap DRIVER_ENTRY so that defender-side `bcdedit /enum FIRMWARE` and CHIPSEC scans no longer show an anomalous entry — the implant lives entirely in firmware. (2) **Sabotage**: ransomware can delete OEM recovery/diagnostic driver entries (vendor BIOS update DXE drivers) to brick the firmware-update path the victim would otherwise use to restore the platform, complementing MBR/GPT wipers.

Detection opportunities

ETW Microsoft-Windows-Kernel-Boot logs the deletion. The high-value heuristic is correlation across a fleet: if a single host suddenly has *fewer* DRIVER_ENTRYs than its hardware-identical peers in your CMDB, that delta is suspect. CHIPSEC's `tools.uefi.uefivar_fuzz`/`platform.smm_dma` and Eclypsium's baseline can flag the absence of expected OEM driver entries. Audit 4673 (SeSystemEnvironmentPrivilege) on the host where the deletion occurred to pin down the parent process.

Direct syscall examples

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

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

cPost-flash cleanup pattern

// Conceptual: after the DXE driver has executed once and written its persistent
// payload into SPI/NVRAM, remove the visible bootstrap entry.
extern NTSTATUS NTAPI NtDeleteDriverEntry(ULONG);

NTSTATUS hide_tracks(ULONG bootstrap_id) {
    NTSTATUS s = NtDeleteDriverEntry(bootstrap_id);
    // Caller must also rewrite DriverOrder via NtSetSystemEnvironmentValueEx.
    return s;
}

rustNaked stub

use std::arch::asm;

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

MITRE ATT&CK mappings

Last verified: 2026-05-20