NtShutdownSystem
Disparador de apagado en modo kernel — apaga, reinicia o cierra el sistema en un syscall.
Prototipo
NTSTATUS NtShutdownSystem( SHUTDOWN_ACTION Action // 0 = ShutdownNoReboot, 1 = ShutdownReboot, 2 = ShutdownPowerOff );
Argumentos
| Name | Type | Dir | Description |
|---|---|---|---|
| Action | SHUTDOWN_ACTION | in | 0 = ShutdownNoReboot (detiene el SO en la pantalla 'Ya es seguro apagar'), 1 = ShutdownReboot, 2 = ShutdownPowerOff. |
IDs de syscalls por versión de Windows
| Versión de Windows | ID de syscall | Build |
|---|---|---|
| Win10 1507 | 0x198 | win10-1507 |
| Win10 1607 | 0x1A1 | win10-1607 |
| Win10 1703 | 0x1A7 | win10-1703 |
| Win10 1709 | 0x1AA | win10-1709 |
| Win10 1803 | 0x1AC | win10-1803 |
| Win10 1809 | 0x1AD | win10-1809 |
| Win10 1903 | 0x1AE | win10-1903 |
| Win10 1909 | 0x1AE | win10-1909 |
| Win10 2004 | 0x1B4 | win10-2004 |
| Win10 20H2 | 0x1B4 | win10-20h2 |
| Win10 21H1 | 0x1B4 | win10-21h1 |
| Win10 21H2 | 0x1B6 | win10-21h2 |
| Win10 22H2 | 0x1B6 | win10-22h2 |
| Win11 21H2 | 0x1BF | win11-21h2 |
| Win11 22H2 | 0x1C3 | win11-22h2 |
| Win11 23H2 | 0x1C3 | win11-23h2 |
| Win11 24H2 | 0x1C6 | win11-24h2 |
| Server 2016 | 0x1A1 | winserver-2016 |
| Server 2019 | 0x1AD | winserver-2019 |
| Server 2022 | 0x1BC | winserver-2022 |
| Server 2025 | 0x1C6 | winserver-2025 |
Módulo del kernel
APIs relacionadas
Stub del syscall
4C 8B D1 mov r10, rcx B8 C6 01 00 00 mov eax, 0x1C6 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
Notas no documentadas
NtShutdownSystem es la primitiva de apagado más cruda que Windows expone a user mode. A diferencia de `ExitWindowsEx` / `InitiateShutdownW`, *no* notifica a procesos, no difunde `WM_QUERYENDSESSION`, no ejecuta scripts de apagado ni honra renombres pendientes — va directo a `PoInitiateSystemShutdown` y derriba el kernel con la `SHUTDOWN_ACTION` elegida. El token llamante debe tener `SeShutdownPrivilege`, que los usuarios interactivos tienen por defecto pero los tokens de servicio o controlados por malware *no* — el atacante normalmente necesita `AdjustTokenPrivileges` para habilitarlo antes. `ShutdownNoReboot` (0) deja la máquina en la pantalla legacy 'Ya puede apagar el equipo' y es raro en uso malicioso; `ShutdownReboot` (1) y `ShutdownPowerOff` (2) son las opciones prácticas.
Uso común por malware
Dos patrones de abuso distintos. **Wipers**: HermeticWiper (DEV-0586 / FoxBlade), IsaacWiper, CaddyWiper y WhisperGate sobrescriben MBR/MFT y luego invocan una primitiva de apagado para forzar la visibilidad del estado no booteable — NtShutdownSystem es la opción de más bajo nivel y evita la UI de apagado user-mode. **Ransomware post-cifrado**: algunas variantes de Conti, LockBit 3.0 ('Black') y BlackCat (ALPHV) reinician el host tras terminar el cifrador para que el usuario vea el fondo de la nota de rescate y el escritorio sea irrecuperable hasta el reinicio. Los wipers lo prefieren cuando ya se abandonó el sigilo; los ransomwares prefieren a menudo `InitiateShutdownW` con REASON_PLANNED para parecer más legítimos durante la breve ventana antes del reinicio.
Oportunidades de detección
`Microsoft-Windows-Kernel-General` Event ID 13 dispara al apagado e incluye el proceso iniciador — invaluable en post-mortem de wiper. Event Log 1074 (User32) registra apagados tipo `ExitWindowsEx` *con* su iniciador; un apagado dirigido por NtShutdownSystem *no* generará Event 1074 porque user32 nunca estuvo en la ruta — esa ausencia es por sí misma una señal útil. `Microsoft-Windows-Wininit` Event 1 registra la fase de inicio del apagado. Los EDR hookean frecuentemente `ntdll!NtShutdownSystem` o el kernel directamente porque la línea base de llamantes legítimos se reduce a `winlogon.exe`, `csrss.exe`, `wininit.exe` y un puñado de herramientas de gestión — cualquier otra cosa es de alta señal.
Ejemplos de syscalls directos
asmx64 direct stub
; Direct syscall stub for NtShutdownSystem (SSN 0x1C6 on Win11 24H2)
NtShutdownSystem PROC
mov r10, rcx ; SHUTDOWN_ACTION
mov eax, 1C6h ; SSN — verify per-build
syscall
ret
NtShutdownSystem ENDPcWiper-style hard reboot
// Final stage of a destructive payload: enable SeShutdownPrivilege and reboot.
#include <windows.h>
#include <winternl.h>
typedef NTSTATUS (NTAPI *pNtShutdownSystem)(int /*SHUTDOWN_ACTION*/);
void HardReboot(void) {
HANDLE hTok;
TOKEN_PRIVILEGES tp = {0};
OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &hTok);
LookupPrivilegeValueW(NULL, L"SeShutdownPrivilege", &tp.Privileges[0].Luid);
tp.PrivilegeCount = 1;
tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
AdjustTokenPrivileges(hTok, FALSE, &tp, 0, NULL, NULL);
CloseHandle(hTok);
pNtShutdownSystem fn = (pNtShutdownSystem)GetProcAddress(
GetModuleHandleA("ntdll.dll"), "NtShutdownSystem");
fn(1 /* ShutdownReboot */); // no WM_QUERYENDSESSION, no shutdown scripts
}rustPower-off path
// Cargo: ntapi = "0.4", windows-sys = "0.59"
use ntapi::ntpoapi::NtShutdownSystem;
use ntapi::ntpoapi::SHUTDOWN_ACTION;
unsafe fn power_off() -> i32 {
// SeShutdownPrivilege must already be enabled on the calling token.
NtShutdownSystem(SHUTDOWN_ACTION::ShutdownPowerOff as i32)
}Mapeos MITRE ATT&CK
Last verified: 2026-05-20