> Windows Syscalls
ntoskrnl.exeT1529T1485T1106

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

NameTypeDirDescription
ActionSHUTDOWN_ACTIONin0 = 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 WindowsID de syscallBuild
Win10 15070x198win10-1507
Win10 16070x1A1win10-1607
Win10 17030x1A7win10-1703
Win10 17090x1AAwin10-1709
Win10 18030x1ACwin10-1803
Win10 18090x1ADwin10-1809
Win10 19030x1AEwin10-1903
Win10 19090x1AEwin10-1909
Win10 20040x1B4win10-2004
Win10 20H20x1B4win10-20h2
Win10 21H10x1B4win10-21h1
Win10 21H20x1B6win10-21h2
Win10 22H20x1B6win10-22h2
Win11 21H20x1BFwin11-21h2
Win11 22H20x1C3win11-22h2
Win11 23H20x1C3win11-23h2
Win11 24H20x1C6win11-24h2
Server 20160x1A1winserver-2016
Server 20190x1ADwinserver-2019
Server 20220x1BCwinserver-2022
Server 20250x1C6winserver-2025

Módulo del kernel

ntoskrnl.exeNtShutdownSystem

APIs relacionadas

ExitWindowsExInitiateShutdownWInitiateSystemShutdownExWNtRaiseHardErrorNtSetSystemPowerState

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 ENDP

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