> Windows Syscalls
ntoskrnl.exeT1003.001T1057T1106

NtReadVirtualMemory

Reads bytes from the virtual address space of a target process into a caller-supplied buffer.

Prototype

NTSTATUS NtReadVirtualMemory(
  HANDLE  ProcessHandle,
  PVOID   BaseAddress,
  PVOID   Buffer,
  SIZE_T  NumberOfBytesToRead,
  PSIZE_T NumberOfBytesRead
);

Arguments

NameTypeDirDescription
ProcessHandleHANDLEinHandle to the target process with PROCESS_VM_READ access right.
BaseAddressPVOIDinSource virtual address in the target process to read from.
BufferPVOIDoutDestination buffer in the caller's address space that receives the bytes.
NumberOfBytesToReadSIZE_TinNumber of bytes to read from BaseAddress.
NumberOfBytesReadPSIZE_ToutOptional. Receives the number of bytes actually read. May be NULL.

Syscall IDs by Windows version

Windows versionSyscall IDBuild
Win10 15070x3Fwin10-1507
Win10 16070x3Fwin10-1607
Win10 17030x3Fwin10-1703
Win10 17090x3Fwin10-1709
Win10 18030x3Fwin10-1803
Win10 18090x3Fwin10-1809
Win10 19030x3Fwin10-1903
Win10 19090x3Fwin10-1909
Win10 20040x3Fwin10-2004
Win10 20H20x3Fwin10-20h2
Win10 21H10x3Fwin10-21h1
Win10 21H20x3Fwin10-21h2
Win10 22H20x3Fwin10-22h2
Win11 21H20x3Fwin11-21h2
Win11 22H20x3Fwin11-22h2
Win11 23H20x3Fwin11-23h2
Win11 24H20x3Fwin11-24h2
Server 20160x3Fwinserver-2016
Server 20190x3Fwinserver-2019
Server 20220x3Fwinserver-2022
Server 20250x3Fwinserver-2025

Kernel module

ntoskrnl.exeNtReadVirtualMemory

Related APIs

ReadProcessMemoryNtWriteVirtualMemoryNtQueryVirtualMemoryMiniDumpWriteDumpZwReadVirtualMemory

Syscall stub

4C 8B D1            mov r10, rcx
B8 3F 00 00 00      mov eax, 0x3F
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

Counterpart to `NtWriteVirtualMemory`, also backed by `MmCopyVirtualMemory` but with the source/destination process roles reversed. SSN `0x3F` has been stable across all shipped Win10/11 builds. Partial reads (one of the source pages unmapped or `PAGE_NOACCESS`) return `STATUS_PARTIAL_COPY` and update `NumberOfBytesRead`. The kernel honours `PROCESS_VM_READ` but it will not bypass page protection — guard pages will fault and propagate as `STATUS_GUARD_PAGE_VIOLATION`.

Common malware usage

Primary read primitive behind LSASS credential theft. Mimikatz, pypykatz, lsassy, nanodump and the Cobalt Strike `mimikatz` BOF all read LSASS process memory either by calling `ReadProcessMemory` (which wraps this syscall) or by issuing the syscall directly to evade ntdll hooks. Also used by infostealers (RedLine, Vidar, Stealc) to scrape secrets from browser processes, and by EDR-evasion tooling to diff in-memory ntdll against the on-disk copy to find inline hooks for unhooking.

MimikatzCobalt StrikeRedLine StealerVidarLazarus toolingQakbot

Detection opportunities

The defining telemetry is Sysmon Event ID 10 (`ProcessAccess`) with `GrantedAccess` containing `PROCESS_VM_READ` (0x0010), especially when the target is `lsass.exe` — the well-known `0x1010`/`0x1410`/`0x1438` masks. Windows Defender's `AttackSurfaceReduction` rule `9E6C4E1F-7D60-472F-BA1A-A39EF669E4B2` blocks LSASS credential dumping by intercepting opens with VM_READ. Direct syscalls do not bypass the kernel-side `PsSetCreateProcessNotifyRoutineEx`/object-callback (`ObRegisterCallbacks`) telemetry that EDRs register on process opens — so the read itself may be invisible, but the prior `NtOpenProcess` is rarely so.

Direct syscall examples

asmx64 direct stub

; Direct syscall stub for NtReadVirtualMemory (SSN 0x3F, stable across all Win10/11)
NtReadVirtualMemory PROC
    mov  r10, rcx          ; syscall convention
    mov  eax, 3Fh          ; SSN
    syscall
    ret
NtReadVirtualMemory ENDP

cntdll diff for unhooking

// Read the .text of ntdll from a clean disk copy and compare to the in-memory ntdll
// to locate inline hooks installed by EDRs. The remote read uses NtCurrentProcess()
// because the comparison is against our own image.
SIZE_T read = 0;
NTSTATUS st = NtReadVirtualMemory(NtCurrentProcess(),
                                  (PVOID)inmem_text_rva,
                                  current_text_copy,
                                  text_size, &read);
if (NT_SUCCESS(st)) diff_and_restore(disk_text_copy, current_text_copy, text_size);

cLSASS minidump read loop

// Open LSASS with PROCESS_VM_READ + PROCESS_QUERY_INFORMATION, then stream pages
// out via NtReadVirtualMemory into an in-memory MiniDump structure (nanodump style).
for (PVOID p = region_base; p < region_end; p = (PBYTE)p + 0x1000) {
    SIZE_T got = 0;
    if (NT_SUCCESS(NtReadVirtualMemory(hLsass, p, page_buf, 0x1000, &got))) {
        write_minidump_page(p, page_buf, got);
    }
}

MITRE ATT&CK mappings

Last verified: 2026-05-20