> Windows Syscalls
ntoskrnl.exeT1014T1622T1106

NtSystemDebugControl

Routes kernel debugger-style requests (kernel R/W, control space, breakpoints, profiler) selected by the SysDbgCommand enum.

Prototype

NTSTATUS NtSystemDebugControl(
  SYSDBG_COMMAND Command,
  PVOID          InputBuffer,
  ULONG          InputBufferLength,
  PVOID          OutputBuffer,
  ULONG          OutputBufferLength,
  PULONG         ReturnLength
);

Arguments

NameTypeDirDescription
CommandSYSDBG_COMMANDinOperation selector: SysDbgReadVirtual, SysDbgWriteVirtual, SysDbgReadPhysical, SysDbgWritePhysical, SysDbgReadControlSpace, SysDbgGetTriageDump, SysDbgBreakPoint, etc.
InputBufferPVOIDinCommand-specific input (typically a SYSDBG_VIRTUAL or SYSDBG_PHYSICAL descriptor with Address/Buffer/Request).
InputBufferLengthULONGinSize in bytes of InputBuffer.
OutputBufferPVOIDoutCommand-specific output buffer (e.g. receives data for SysDbgReadVirtual).
OutputBufferLengthULONGinSize in bytes of OutputBuffer.
ReturnLengthPULONGoutOptional. Receives the number of bytes actually written to OutputBuffer.

Syscall IDs by Windows version

Windows versionSyscall IDBuild
Win10 15070x1A1win10-1507
Win10 16070x1AAwin10-1607
Win10 17030x1B0win10-1703
Win10 17090x1B3win10-1709
Win10 18030x1B5win10-1803
Win10 18090x1B6win10-1809
Win10 19030x1B7win10-1903
Win10 19090x1B7win10-1909
Win10 20040x1BDwin10-2004
Win10 20H20x1BDwin10-20h2
Win10 21H10x1BDwin10-21h1
Win10 21H20x1BFwin10-21h2
Win10 22H20x1BFwin10-22h2
Win11 21H20x1C9win11-21h2
Win11 22H20x1CDwin11-22h2
Win11 23H20x1CDwin11-23h2
Win11 24H20x1D0win11-24h2
Server 20160x1AAwinserver-2016
Server 20190x1B6winserver-2019
Server 20220x1C5winserver-2022
Server 20250x1D0winserver-2025

Kernel module

ntoskrnl.exeNtSystemDebugControl

Related APIs

KdSystemDebugControlDebugActiveProcessNtSetDebugFilterStateNtQuerySystemInformationNtCreateDebugObject

Syscall stub

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

NtSystemDebugControl is a multiplexer for debugger-style kernel operations. The Command enum (SYSDBG_COMMAND / SysDbgCommand) selects between virtual/physical memory read and write, control-space access, MSR reads, profiler control, breakpoint installation, triage-dump retrieval and several legacy commands. *Crucially*, on free / retail builds Microsoft has progressively restricted the truly powerful commands: SysDbgReadVirtual, SysDbgWriteVirtual, SysDbgReadPhysical and SysDbgWritePhysical return STATUS_NOT_IMPLEMENTED unless the system is running a debug (checked) kernel or has been booted with the `/DEBUG` kernel-debugger enabled. On a normal Win10/Win11 desktop those bytes are inert. The caller also requires SeDebugPrivilege.

Common malware usage

Historically — Windows XP and early Vista — NtSystemDebugControl with SysDbgReadVirtual/WriteVirtual was a clean userland-to-kernel R/W primitive that several rootkits abused. Rustock and the BlackEnergy 2 kernel driver are commonly cited examples; numerous research PoCs from the same era used it for SSDT patching and kernel structure tampering. Since Vista x64 + PatchGuard + the free-build restriction this avenue is essentially closed on modern systems. Modern malware does not abuse NtSystemDebugControl for kernel R/W — the path is shut. Indirect uses persist: SysDbgGetTriageDump can be invoked by anti-analysis code to detect the presence of a kernel debugger or running profiler.

Detection opportunities

On a modern system, *any* successful call to NtSystemDebugControl from a non-debugger process is suspicious. ETW Microsoft-Windows-Kernel-Audit-API-Calls covers privileged debugger surface, and SeDebugPrivilege usage shows up in security auditing (Event ID 4673). EDR-side, hook ntdll!NtSystemDebugControl, decode the command, and treat SysDbgReadVirtual / SysDbgWriteVirtual / SysDbgReadControlSpace / SysDbgReadMsr as high-confidence indicators regardless of return status. Calls that return STATUS_NOT_IMPLEMENTED are themselves a probing signal worth logging.

Direct syscall examples

asmx64 direct stub (Win11 24H2 SSN)

; Direct syscall stub for NtSystemDebugControl (SSN 0x1D0 on Win11 24H2 / Server 2025)
NtSystemDebugControl PROC
    mov  r10, rcx          ; syscall convention
    mov  eax, 1D0h         ; SSN for win11-24h2
    syscall
    ret
NtSystemDebugControl ENDP

cSysDbgReadVirtual sketch (gated on free builds)

// Read N bytes from a kernel virtual address.
// On a stock Win10/Win11 system this returns STATUS_NOT_IMPLEMENTED.
// Only works against a checked kernel or with the system booted /DEBUG.
typedef enum _SYSDBG_COMMAND {
    SysDbgReadVirtual           = 8,
    SysDbgWriteVirtual          = 9,
    SysDbgReadPhysical          = 10,
    SysDbgWritePhysical         = 11,
    SysDbgReadControlSpace      = 12,
    SysDbgGetTriageDump         = 29,
} SYSDBG_COMMAND;

typedef struct _SYSDBG_VIRTUAL {
    PVOID  Address;
    PVOID  Buffer;
    ULONG  Request;
} SYSDBG_VIRTUAL, *PSYSDBG_VIRTUAL;

// caller must have SeDebugPrivilege enabled
BYTE buf[16] = { 0 };
SYSDBG_VIRTUAL in = {
    .Address = (PVOID)0xfffff80000000000ULL,  // some kernel VA
    .Buffer  = buf,
    .Request = sizeof(buf),
};
ULONG returned = 0;
NTSTATUS s = NtSystemDebugControl(SysDbgReadVirtual,
                                  &in, sizeof(in),
                                  NULL, 0,
                                  &returned);
// On a free build: s == STATUS_NOT_IMPLEMENTED (0xC0000002).

rustwindows-sys + naked syscall stub

// Cargo: windows-sys = "0.59"
use std::arch::asm;

#[unsafe(naked)]
unsafe extern "system" fn nt_system_debug_control_stub() {
    asm!(
        "mov r10, rcx",
        "mov eax, 0x1D0",   // Win11 24H2; resolve dynamically for other builds
        "syscall",
        "ret",
        options(noreturn),
    );
}

MITRE ATT&CK mappings

Last verified: 2026-05-20