NtCreateSection
Erzeugt ein Section-Objekt, gestützt durch eine Datei oder das System-Pagefile, für Shared-Memory-Mapping.
Prototyp
NTSTATUS NtCreateSection( PHANDLE SectionHandle, ACCESS_MASK DesiredAccess, POBJECT_ATTRIBUTES ObjectAttributes, PLARGE_INTEGER MaximumSize, ULONG SectionPageProtection, ULONG AllocationAttributes, HANDLE FileHandle );
Argumente
| Name | Type | Dir | Description |
|---|---|---|---|
| SectionHandle | PHANDLE | out | Erhält das Handle auf das neue Section-Objekt. |
| DesiredAccess | ACCESS_MASK | in | Rechte für das Section-Handle, z. B. SECTION_MAP_READ | SECTION_MAP_WRITE | SECTION_MAP_EXECUTE. |
| ObjectAttributes | POBJECT_ATTRIBUTES | in | Optional. Setzt Objektname (für benannte Sections) und Sicherheitsattribute. NULL für anonym. |
| MaximumSize | PLARGE_INTEGER | in | Maximalgröße der Section. Pflicht für pagefile-basierte, optional bei file-basierten. |
| SectionPageProtection | ULONG | in | Initialer Seitenschutz, z. B. PAGE_READONLY, PAGE_READWRITE, PAGE_EXECUTE_READWRITE. |
| AllocationAttributes | ULONG | in | SEC_COMMIT, SEC_RESERVE, SEC_IMAGE, SEC_LARGE_PAGES usw. SEC_IMAGE parst FileHandle als PE. |
| FileHandle | HANDLE | in | Handle auf die Backing-Datei oder NULL für eine pagefile-basierte (anonyme) Section. |
Syscall-IDs pro Windows-Version
| Windows-Version | Syscall-ID | Build |
|---|---|---|
| Win10 1507 | 0x4A | win10-1507 |
| Win10 1607 | 0x4A | win10-1607 |
| Win10 1703 | 0x4A | win10-1703 |
| Win10 1709 | 0x4A | win10-1709 |
| Win10 1803 | 0x4A | win10-1803 |
| Win10 1809 | 0x4A | win10-1809 |
| Win10 1903 | 0x4A | win10-1903 |
| Win10 1909 | 0x4A | win10-1909 |
| Win10 2004 | 0x4A | win10-2004 |
| Win10 20H2 | 0x4A | win10-20h2 |
| Win10 21H1 | 0x4A | win10-21h1 |
| Win10 21H2 | 0x4A | win10-21h2 |
| Win10 22H2 | 0x4A | win10-22h2 |
| Win11 21H2 | 0x4A | win11-21h2 |
| Win11 22H2 | 0x4A | win11-22h2 |
| Win11 23H2 | 0x4A | win11-23h2 |
| Win11 24H2 | 0x4A | win11-24h2 |
| Server 2016 | 0x4A | winserver-2016 |
| Server 2019 | 0x4A | winserver-2019 |
| Server 2022 | 0x4A | winserver-2022 |
| Server 2025 | 0x4A | winserver-2025 |
Kernel-Modul
Verwandte APIs
Syscall-Stub
4C 8B D1 mov r10, rcx B8 4A 00 00 00 mov eax, 0x4A 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
Erzeugt ein `_SECTION`-Objekt — die Kernel-Primitive hinter jedem File-Mapping, jedem geladenen Image und jeder Shared-Memory-Region in Windows. SSN `0x4A` ist über alle Win10/11-Builds stabil. `SEC_IMAGE` ist das mächtigste Flag: Der Kernel parst FileHandle als PE (validiert Header, wendet Relocations an, baut Subsections gemäß `IMAGE_SECTION_HEADER` auf) und die resultierende View *ist* aus Kernel-Sicht ein geladenes Modul — sie erscheint in `PsLoadedModuleList`-äquivalenten Strukturen und erzeugt `Image Load`-Events. Anonyme (`FileHandle = NULL`) pagefile-basierte Sections sind schlicht geteiltes RAM.
Häufige Malware-Nutzung
Der Setup-Schritt jeder Section-basierten Injection-Technik. Anonyme + `PAGE_EXECUTE_READWRITE`-Sections speisen Process Doppelgänging, Transacted Hollowing, Atom Bombing und die ursprüngliche `MapViewOfSection`-Injection. `SEC_IMAGE`-Sections über sauberen signierten DLLs speisen Module-Stomping-Loader und `KnownDlls`-Poisoning. Process Ghosting (von Gabriel Landau) erzeugt eine Delete-Pending-Datei, baut eine `SEC_IMAGE`-Section darüber und löscht die Datei dann, bevor die Section ausgehängt wird — zurück bleibt ein ausführbares Image im Speicher ohne Disk-Artefakt für den AV.
Erkennungsmöglichkeiten
`NtCreateSection` selbst ist zu häufig (jedes `LoadLibrary` und `CreateFileMapping` trifft es), um direkt zu alarmieren. Die Signale entstehen weiter unten: ETW Threat Intelligence emittiert Events, wenn eine Section ausführbar in einen Remote-Prozess gemappt wird; PE-Sieve und Moneta markieren `MappedImage`-Regionen, deren Backing-Datei gelöscht oder ersetzt wurde; Minifilter-Treiber beobachten `IRP_MJ_CREATE` mit `FILE_DELETE_ON_CLOSE` gefolgt von einer Section-Erzeugung als Process-Ghosting-Muster. `SEC_IMAGE`-Sections über Nicht-Microsoft-Dateien in PPL-Zielen sind hochverdächtig. Beachten Sie zudem, dass `SEC_NO_CHANGE` + `SEC_IMAGE` mitunter genutzt wird, um eine Region nach dem Mappen gegen `NtProtectVirtualMemory`-Änderungen resistent zu machen.
Direkte Syscall-Beispiele
asmx64 direct stub
; Direct syscall stub for NtCreateSection (SSN 0x4A, stable across all Win10/11)
NtCreateSection PROC
mov r10, rcx ; syscall convention
mov eax, 4Ah ; SSN
syscall
ret
NtCreateSection ENDPcAnonymous RWX section for injection
// Pagefile-backed RWX section, used as the carrier for cross-process shellcode.
HANDLE hSection = NULL;
LARGE_INTEGER size = { .QuadPart = 0x10000 };
NTSTATUS st = NtCreateSection(&hSection, SECTION_ALL_ACCESS, NULL, &size,
PAGE_EXECUTE_READWRITE, SEC_COMMIT, NULL);
if (!NT_SUCCESS(st)) return st;
// hSection can now be mapped RW locally and RX remotely (see NtMapViewOfSection).cHell's Gate dynamic lookup
// Resolve SSN at runtime so the indirect-syscall trampoline doesn't need a build switch.
typedef NTSTATUS (NTAPI *pNtCreateSection)(PHANDLE, ACCESS_MASK,
POBJECT_ATTRIBUTES, PLARGE_INTEGER,
ULONG, ULONG, HANDLE);
DWORD ssn = GetSyscallNumber(GetProcAddress(GetModuleHandleA("ntdll.dll"),
"NtCreateSection"));
set_ssn(ssn);
indirect_syscall_invoke(/* &hSection, ... */);MITRE ATT&CK-Mappings
Last verified: 2026-05-20