NtDeleteDriverEntry
Removes a registered EFI_DRIVER_ENTRY by ID, deleting the corresponding UEFI Driver#### NVRAM variable.
Prototype
NTSTATUS NtDeleteDriverEntry( ULONG Id );
Arguments
| Name | Type | Dir | Description |
|---|---|---|---|
| Id | ULONG | in | Firmware-assigned identifier of the driver entry to remove (the value previously returned by NtAddDriverEntry). |
Syscall IDs by Windows version
| Windows version | Syscall ID | Build |
|---|---|---|
| Win10 1507 | 0xC3 | win10-1507 |
| Win10 1607 | 0xC6 | win10-1607 |
| Win10 1703 | 0xC9 | win10-1703 |
| Win10 1709 | 0xCA | win10-1709 |
| Win10 1803 | 0xCB | win10-1803 |
| Win10 1809 | 0xCC | win10-1809 |
| Win10 1903 | 0xCD | win10-1903 |
| Win10 1909 | 0xCD | win10-1909 |
| Win10 2004 | 0xD1 | win10-2004 |
| Win10 20H2 | 0xD1 | win10-20h2 |
| Win10 21H1 | 0xD1 | win10-21h1 |
| Win10 21H2 | 0xD2 | win10-21h2 |
| Win10 22H2 | 0xD2 | win10-22h2 |
| Win11 21H2 | 0xD7 | win11-21h2 |
| Win11 22H2 | 0xD8 | win11-22h2 |
| Win11 23H2 | 0xD8 | win11-23h2 |
| Win11 24H2 | 0xDA | win11-24h2 |
| Server 2016 | 0xC6 | winserver-2016 |
| Server 2019 | 0xCC | winserver-2019 |
| Server 2022 | 0xD6 | winserver-2022 |
| Server 2025 | 0xDA | winserver-2025 |
Kernel module
Related APIs
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 ENDPcPost-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