NtMapViewOfSectionEx
Syscall extendido de mapping de sección (Windows 10 1809+) que acepta restricciones MEM_EXTENDED_PARAMETER.
Prototipo
NTSTATUS NtMapViewOfSectionEx( HANDLE SectionHandle, HANDLE ProcessHandle, PVOID *BaseAddress, PLARGE_INTEGER SectionOffset, PSIZE_T ViewSize, ULONG AllocationType, ULONG Win32Protect, PMEM_EXTENDED_PARAMETER ExtendedParameters, ULONG ParameterCount );
Argumentos
| Name | Type | Dir | Description |
|---|---|---|---|
| SectionHandle | HANDLE | in | Handle a la sección a mapear. Debe tener acceso SECTION_MAP_* apropiado. |
| ProcessHandle | HANDLE | in | Proceso objetivo. NtCurrentProcess() para sí mismo; handle remoto para mapping entre procesos. |
| BaseAddress | PVOID* | in/out | Puntero a la dirección base solicitada. NULL deja que el kernel elija. Actualizado al retornar. |
| SectionOffset | PLARGE_INTEGER | in | Offset opcional dentro de la sección, debe estar alineado a 64 KiB. |
| ViewSize | PSIZE_T | in/out | Tamaño de vista solicitado en entrada, tamaño realmente mapeado en salida. 0 mapea toda la sección. |
| AllocationType | ULONG | in | MEM_RESERVE, MEM_COMMIT, MEM_LARGE_PAGES, MEM_TOP_DOWN, SEC_NO_CHANGE etc. |
| Win32Protect | ULONG | in | Protección inicial de página (PAGE_READONLY, PAGE_EXECUTE_READ, PAGE_EXECUTE_WRITECOPY, …). |
| ExtendedParameters | PMEM_EXTENDED_PARAMETER | in | Array opcional de parámetros extendidos (restricciones de rango de direcciones, opt-out CFG, hints NUMA). |
| ParameterCount | ULONG | in | Número de entradas en ExtendedParameters. 0 si ExtendedParameters es NULL. |
IDs de syscalls por versión de Windows
| Versión de Windows | ID de syscall | Build |
|---|---|---|
| Win10 1803 | 0x10D | win10-1803 |
| Win10 1809 | 0x10E | win10-1809 |
| Win10 1903 | 0x10F | win10-1903 |
| Win10 1909 | 0x10F | win10-1909 |
| Win10 2004 | 0x114 | win10-2004 |
| Win10 20H2 | 0x114 | win10-20h2 |
| Win10 21H1 | 0x114 | win10-21h1 |
| Win10 21H2 | 0x115 | win10-21h2 |
| Win10 22H2 | 0x115 | win10-22h2 |
| Win11 21H2 | 0x11B | win11-21h2 |
| Win11 22H2 | 0x11C | win11-22h2 |
| Win11 23H2 | 0x11C | win11-23h2 |
| Win11 24H2 | 0x11E | win11-24h2 |
| Server 2019 | 0x10E | winserver-2019 |
| Server 2022 | 0x11A | winserver-2022 |
| Server 2025 | 0x11E | winserver-2025 |
Módulo del kernel
APIs relacionadas
Stub del syscall
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
Notas no documentadas
Introducido en Windows 10 1809 (Redstone 5) como análogo de section-mapping a `NtAllocateVirtualMemoryEx`. La adición clave respecto a `NtMapViewOfSection` es el array `ExtendedParameters`, que actualmente acepta `MemExtendedParameterAddressRequirements` (LowestStartingAddress / HighestEndingAddress / Alignment), `MemExtendedParameterAttributeFlags` (`MEM_EXTENDED_PARAMETER_EC_CODE`, `MEM_EXTENDED_PARAMETER_IMAGE_NO_HOTPATCH`) y `MemExtendedParameterImageMachine` (Arm64EC). La restricción de rango de direcciones es lo que la hace interesante para herramientas ofensivas — se puede pedir que el mapping caiga por encima del límite de 32 bits o lejos de un rango heurístico conocido del scanner. No presente en Windows 10 1507–1709.
Uso común por malware
Lo usan los loaders reflectivos modernos y de module stomping que quieren control fino sobre la dirección de mapping. El **Phantom DLL Hollowing** (Forrest Orr, 2020) mapea una DLL Microsoft firmada limpia en disco con `SEC_IMAGE` vía `NtCreateSection` + `NtMapViewOfSectionEx`, luego sobreescribe las páginas `.text` mientras el kernel sigue creyendo que el mapping es image-backed y firmado — derrotando las comprobaciones de hash de módulo del EDR. El parámetro `MemExtendedParameterAddressRequirements` también se usa para imitar el comportamiento de mapping en direcciones altas de `LoadLibraryEx`, mezclándose con bases de módulos legítimos. SSN ausente en Windows 10 1507–1709, así que loaders que apunten a esos builds deben caer al `NtMapViewOfSection` simple.
Oportunidades de detección
Casi todo uso de `NtMapViewOfSectionEx` para mappings ejecutables es anómalo fuera de un pequeño conjunto de loaders del sistema (`ntdll!LdrpMapViewOfSection`, `wow64cpu`). Los EDR que hookean esta rutina en ntdll capturan a la mayoría de llamadores no del sistema; los usuarios de syscalls directos sortean ese hook pero igualmente disparan eventos ETW `Microsoft-Windows-Kernel-Process` ImageLoad cuando la sección mapeada es imagen — y la *ausencia* de un evento ImageLoad para un mapping ejecutable es en sí misma un IOC (evasión manual-map). Cazar mappings sección-imagen cuyo fichero de backing no aparece después en la lista de módulos cargados (`PEB_LDR_DATA`).
Ejemplos de syscalls directos
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 ENDPrustPhantom 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
}Mapeos MITRE ATT&CK
Last verified: 2026-05-20