> Windows Syscalls
ntoskrnl.exeT1055.012T1620T1106

NtMapViewOfSectionEx

Erweiterter Section-Mapping-Syscall (ab Windows 10 1809), der MEM_EXTENDED_PARAMETER-Vorgaben akzeptiert.

Prototyp

NTSTATUS NtMapViewOfSectionEx(
  HANDLE                  SectionHandle,
  HANDLE                  ProcessHandle,
  PVOID                  *BaseAddress,
  PLARGE_INTEGER          SectionOffset,
  PSIZE_T                 ViewSize,
  ULONG                   AllocationType,
  ULONG                   Win32Protect,
  PMEM_EXTENDED_PARAMETER ExtendedParameters,
  ULONG                   ParameterCount
);

Argumente

NameTypeDirDescription
SectionHandleHANDLEinHandle auf die zu mappende Section. Erfordert passenden SECTION_MAP_*-Zugriff.
ProcessHandleHANDLEinZielprozess. NtCurrentProcess() für sich selbst; Remote-Handle für prozessübergreifendes Mapping.
BaseAddressPVOID*in/outZeiger auf die gewünschte Basisadresse. NULL überlässt die Wahl dem Kernel. Wird beim Rückkehren aktualisiert.
SectionOffsetPLARGE_INTEGERinOptionaler Offset innerhalb der Section, muss 64-KiB-ausgerichtet sein.
ViewSizePSIZE_Tin/outEingabe: gewünschte View-Größe. Ausgabe: tatsächlich gemappte Größe. 0 mappt die gesamte Section.
AllocationTypeULONGinMEM_RESERVE, MEM_COMMIT, MEM_LARGE_PAGES, MEM_TOP_DOWN, SEC_NO_CHANGE usw.
Win32ProtectULONGinInitialer Seitenschutz (PAGE_READONLY, PAGE_EXECUTE_READ, PAGE_EXECUTE_WRITECOPY, …).
ExtendedParametersPMEM_EXTENDED_PARAMETERinOptionales Array erweiterter Parameter (Adressbereichs-Restriktionen, CFG-Opt-out, NUMA-Hints).
ParameterCountULONGinAnzahl der Einträge in ExtendedParameters. 0, falls ExtendedParameters NULL ist.

Syscall-IDs pro Windows-Version

Windows-VersionSyscall-IDBuild
Win10 18030x10Dwin10-1803
Win10 18090x10Ewin10-1809
Win10 19030x10Fwin10-1903
Win10 19090x10Fwin10-1909
Win10 20040x114win10-2004
Win10 20H20x114win10-20h2
Win10 21H10x114win10-21h1
Win10 21H20x115win10-21h2
Win10 22H20x115win10-22h2
Win11 21H20x11Bwin11-21h2
Win11 22H20x11Cwin11-22h2
Win11 23H20x11Cwin11-23h2
Win11 24H20x11Ewin11-24h2
Server 20190x10Ewinserver-2019
Server 20220x11Awinserver-2022
Server 20250x11Ewinserver-2025

Kernel-Modul

ntoskrnl.exeNtMapViewOfSectionEx

Verwandte APIs

MapViewOfFile3NtMapViewOfSectionNtCreateSectionNtAllocateVirtualMemoryExVirtualAlloc2NtUnmapViewOfSection

Syscall-Stub

4C 8B D1            mov r10, rcx
B8 1E 01 00 00      mov eax, 0x11E     ; Win11 24H2 SSN
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

Undokumentierte Hinweise

Eingeführt in Windows 10 1809 (Redstone 5) als Section-Mapping-Pendant zu `NtAllocateVirtualMemoryEx`. Die zentrale Ergänzung gegenüber `NtMapViewOfSection` ist das Array `ExtendedParameters`, das aktuell `MemExtendedParameterAddressRequirements` (LowestStartingAddress / HighestEndingAddress / Alignment), `MemExtendedParameterAttributeFlags` (`MEM_EXTENDED_PARAMETER_EC_CODE`, `MEM_EXTENDED_PARAMETER_IMAGE_NO_HOTPATCH`) und `MemExtendedParameterImageMachine` (Arm64EC) akzeptiert. Die Adressbereichs-Restriktion macht das API für offensive Tools interessant — man kann verlangen, dass das Mapping oberhalb der 32-Bit-Grenze landet oder außerhalb eines bekannten Scanner-Heuristikbereichs. Auf Windows 10 1507–1709 nicht vorhanden.

Häufige Malware-Nutzung

Wird von modernen Reflective- und Module-Stomping-Loadern eingesetzt, die feingranulare Kontrolle über die Mapping-Adresse wollen. **Phantom DLL Hollowing** (Forrest Orr, 2020) mappt eine sauber-on-disk Microsoft-signierte DLL mit `SEC_IMAGE` über `NtCreateSection` + `NtMapViewOfSectionEx` und überschreibt anschließend die `.text`-Seiten, während der Kernel das Mapping weiterhin als image-backed und signiert betrachtet — und so EDR-Modul-Hash-Checks aushebelt. Der Parameter `MemExtendedParameterAddressRequirements` dient außerdem dazu, das High-Address-Mapping-Verhalten von `LoadLibraryEx` zu imitieren, um sich unter legitime Modul-Basisadressen zu mischen. SSN auf Windows 10 1507–1709 nicht verfügbar, Loader für diese Builds müssen auf das einfache `NtMapViewOfSection` zurückfallen.

Erkennungs­möglichkeiten

Nahezu jeder Einsatz von `NtMapViewOfSectionEx` für ausführbare Mappings ist außerhalb einer kleinen Menge von System-Loadern (`ntdll!LdrpMapViewOfSection`, `wow64cpu`) anomal. EDRs, die diese Routine in ntdll hooken, erwischen die meisten Nicht-System-Aufrufer; Direct-Syscall-Nutzer umgehen den Hook, lösen aber dennoch ETW-`Microsoft-Windows-Kernel-Process`-ImageLoad-Events aus, wenn die gemappte Section ein Image ist — und das *Fehlen* eines ImageLoad-Events für ein ausführbares Mapping ist selbst ein IOC (Manual-Map-Evasion). Hunting auf Image-Section-Maps, deren Backing-Datei anschließend nicht in der Modulliste (`PEB_LDR_DATA`) erscheint.

Direkte Syscall-Beispiele

cHigh-address mapping with MemExtendedParameterAddressRequirements

// Force the mapping to land above 0x0000_0001_0000_0000 to dodge
// scanner heuristics that focus on low VAs.
MEM_EXTENDED_PARAMETER ep[1] = {0};
MEM_ADDRESS_REQUIREMENTS req = {0};
req.LowestStartingAddress  = (PVOID)0x0000000100000000ULL;
req.HighestEndingAddress   = (PVOID)0x00007FFFFFFFFFFFULL;
req.Alignment              = 0; // default 64 KiB

ep[0].Type    = MemExtendedParameterAddressRequirements;
ep[0].Pointer = &req;

PVOID base = NULL; SIZE_T viewSize = 0;
NTSTATUS s = NtMapViewOfSectionEx(
    hSection, NtCurrentProcess(),
    &base, NULL, &viewSize,
    0, PAGE_EXECUTE_READ,
    ep, 1);

asmx64 direct stub (Win11 24H2)

; NtMapViewOfSectionEx direct stub — SSN 0x11E on Win11 24H2.
; Note: ParameterCount is the 9th argument; spilled onto the stack per
; the Win64 calling convention (shadow + 5th slot).
NtMapViewOfSectionEx PROC
    mov  r10, rcx
    mov  eax, 11Eh
    syscall
    ret
NtMapViewOfSectionEx ENDP

rustPhantom DLL Hollowing skeleton

// Phantom DLL Hollowing (Forrest Orr, 2020) — abbreviated.
// 1) Open kernelbase.dll as a SEC_IMAGE section.
// 2) Map it with NtMapViewOfSectionEx into our process.
// 3) Overwrite the .text bytes with shellcode while the kernel still
//    believes the region is signed image-backed memory.
use ntapi::ntmmapi::NtMapViewOfSectionEx;
use winapi::shared::ntdef::{HANDLE, PVOID};
use std::{mem, ptr::null_mut};

unsafe fn map_image(section: HANDLE) -> PVOID {
    let mut base: PVOID = null_mut();
    let mut view: usize = 0;
    let s = NtMapViewOfSectionEx(
        section,
        -1isize as HANDLE, // NtCurrentProcess()
        &mut base,
        null_mut(),
        &mut view,
        0,
        0x20, // PAGE_EXECUTE_READ
        null_mut(),
        0,
    );
    assert!(s >= 0);
    base
}

MITRE ATT&CK-Mappings

Last verified: 2026-05-20