Endpoint Detection and Response (EDR) platforms and next-generation antivirus (NGAV) engines have traditionally anchored their defenses on process inspection and file-system callbacks. By monitoring file creation, calculating binary hashes, and inspecting memory structures during process initialization, security sensors intercept malicious software before execution. However, sophisticated offensive tradecraft continuously shifts toward subterranean operating system primitives. Among these, Process Ghosting stands out as a radical departure from classical process manipulation techniques.
Unlike Process Hollowing, which unmaps memory in running processes, or Process Doppelganging, which relies on deprecated Transactional NTFS (TxF) APIs, Process Ghosting exploits the boundary states of the Windows file system and memory manager. By creating an executable image section from a file marked in a delete-pending state, an adversary executes arbitrary code from an unbacked binary that never exists on disk during process telemetry collection.
When host-level security sensors are blinded at the moment of execution, the defensive perimeter falls back onto network communication boundaries. This technical deep-dive examines the structural mechanics of Process Ghosting, the failure modes of file-system minifilters, and how kernel-level Layer 3 cryptographic encapsulation via WireGuard isolates malicious egress traffic.
The Evolution of Process Injection: From Hollowing to Ghosting
To comprehend why Process Ghosting renders traditional endpoint telemetry ineffective, we must trace the technical lineage of process injection techniques:
+-------------------------------------------------------------------------------+
| EVOLUTION OF WINDOWS PROCESS TAMPERING MECHANICS |
+-------------------------------------------------------------------------------+
| Technique | Primary Mechanism | EDR Detection Vector |
|----------------------|-----------------------------|-------------------------|
| Process Hollowing | NtUnmapViewOfSection on | Suspicious unmapping, |
| | suspended host process | unbacked PAGE_EXECUTE |
|----------------------|-----------------------------|-------------------------|
| Process Doppelganging| Transactional NTFS (TxF) | Deprecated TxF APIs, |
| | transacted write & rollback | NtCreateTransaction hook|
|----------------------|-----------------------------|-------------------------|
| Process Herpaderping | File write, section map, | Disk I/O race, file |
| | overwrite disk payload | locks, temporary artifact|
|----------------------|-----------------------------|-------------------------|
| Process Ghosting | Delete-pending file state, | File is deleted before |
| | NtCreateSection(SEC_IMAGE) | callback; EDR cannot open|
+-------------------------------------------------------------------------------+
Classical injection techniques leave measurable forensic artifacts. Process Hollowing triggers alerts because modern EDR drivers monitor NtUnmapViewOfSection and identify unbacked executable memory pages (PAGE_EXECUTE_READWRITE). Process Doppelganging circumvents static file scanners by writing malicious payloads inside an isolated NTFS transaction and rolling it back, but major security vendors quickly placed behavioral heuristics and kernel hooks on NtCreateTransaction and NtRollbackTransaction.
Process Ghosting resolves these tactical limitations. It does not invoke transactional APIs, does not modify memory of existing processes, and leaves zero executable footprint on the physical volume when the process starts.
Technical Anatomy of Process Ghosting Execution
The core mechanism of Process Ghosting lies in how the Windows NT kernel coordinates file deletion, I/O minifilter callbacks, and the memory manager's image section creation.
+-------------------------------------------------------------------------------+
| PROCESS GHOSTING STEP-BY-STEP EXECUTION |
+-------------------------------------------------------------------------------+
| 1. NtCreateFile(FILE_DISPOSITION_INFORMATION / DELETE permissions) |
| |
| 2. NtSetInformationFile(FileDispositionInformation, Delete = TRUE) |
| --> File enters "Delete-Pending" state on NTFS volume |
| |
| 3. NtWriteFile(Payload_PE_Bytes) |
| --> Writes malicious binary directly into delete-pending file handle |
| |
| 4. NtCreateSection(Handle, SEC_IMAGE, PAGE_EXECUTE_READ) |
| --> Memory Manager maps Section; file handle locked from other processes |
| |
| 5. NtClose(FileHandle) |
| --> File physically erased from NTFS MFT; Section remains resident in RAM |
| |
| 6. NtCreateProcessEx(ProcessHandle, SectionHandle) |
| --> Kernel creates process object from ghost section |
| |
| 7. RtlCreateProcessParametersEx() & NtCreateThreadEx() |
| --> Process begins execution; PsSetCreateProcessNotifyRoutineEx fires |
| --> EDR callback attempts file scan: STATUS_FILE_DELETED / Minifilter fails|
+-------------------------------------------------------------------------------+
Phase 1: Entering the Delete-Pending State
An attacker process first creates a target file on an NTFS volume with DELETE and FILE_WRITE_DATA access rights. Crucially, the caller calls NtSetInformationFile with the FileDispositionInformation class, setting the DeleteFile boolean flag to TRUE.
At this stage, the file enters a delete-pending state. Under NTFS semantics, a delete-pending file cannot be opened by any subsequent thread or external process. Any call to CreateFileW or NtOpenFile initiated by security products returns STATUS_DELETE_PENDING (0xC0000043). However, existing open handles to the file remain fully valid for reading and writing.
Phase 2: Payload Staging and Image Section Mapping
With the delete-pending handle open, the attacker writes the raw Portable Executable (PE) payload into the file using standard NtWriteFile calls.
Next comes the critical operating system operation: NtCreateSection with the SEC_IMAGE flag. The Windows Memory Manager parses the PE headers directly from the delete-pending file handle, verifies PE structure, calculates section alignments, and constructs an image section object.
Because the Memory Manager references the internal FILE_OBJECT rather than issuing a new NtOpenFile, the image section maps successfully into memory despite the delete-pending barrier.
Phase 3: The Vanishing Act and Process Genesis
Once the section handle is secured, the attacker closes the original file handle via NtClose. Because the file was marked for deletion and no other handles remain open, the NTFS file system instantly removes the directory entry and deallocates the Master File Table (MFT) record. The physical file disappears completely from disk.
Yet, because the Memory Manager maintains a reference count on the image section object, the mapped executable data persists in RAM.
The adversary now proceeds with low-level process creation:
- Invoking
NtCreateProcessExusing the unbacked Section Handle. - Allocating and initializing the Process Environment Block (PEB) and command-line parameters via
RtlCreateProcessParametersEx. - Spawning the primary execution thread via
NtCreateThreadEx.
Why EDR Minifilters and Kernel Callbacks Fail
The effectiveness of Process Ghosting stems from an asynchronous timing flaw in Windows security architecture. Security vendors rely on two primary kernel mechanisms to intercept suspicious binaries:
- File System Minifilter Drivers (
FltRegisterFilter): Minifilters register pre-operation and post-operation callbacks forIRP_MJ_CREATE,IRP_MJ_CLEANUP, andIRP_MJ_WRITE. When a file is modified, antivirus engines scan the content. However, because security software cannot inspect partial file writes, scanning is deferred until handle close (IRP_MJ_CLEANUP). By the time cleanup occurs on a delete-pending file, the file is already gone. - Process Notification Callbacks (
PsSetCreateProcessNotifyRoutineEx): The Windows kernel notifies registered EDR drivers when a process object is created. The driver receives aPS_CREATE_NOTIFY_INFOstructure containing theImageFileNameand a pointer to theFileObject.
[Attacker Thread] [EDR Kernel Driver]
| |
|-- NtClose(FileHandle) |
| (File deleted from NTFS) |
| |
|-- NtCreateProcessEx(Section) |
| (Kernel fires PsSetCreateProcessNotify)-->|
| |-- Checks PS_CREATE_NOTIFY_INFO
| |-- Attempts FltCreateFileEx()
| | ==> Returns STATUS_FILE_DELETED!
| |-- Cannot calculate SHA256
| |-- Cannot verify Authenticode
|<-- Process allowed to spawn ----------------|
|
[Ghost Process Running]
When the EDR callback executes, it attempts to obtain a file handle to compute the cryptographic hash or inspect digital signatures. The driver calls FltCreateFileEx or ObOpenObjectByPointer on the FileObject. But because the file has already been wiped from disk, the NTFS driver returns STATUS_FILE_DELETED (0xC0000123).
Faced with a missing file on disk, most endpoint security sensors fail open, allowing the process to execute rather than crashing legitimate system operations.
Network-Level Containment: Isolating Ghost Processes
When host-based endpoint defenses fail to recognize the birth of a ghost process, the threat model transitions from endpoint detection to network-level isolation. A ghost process must eventually establish network communication to fulfill its operational objectives: command-and-control (C2) beaconing, remote access payload retrieval, or data exfiltration.
At the network boundary, the operating system kernel cannot hide the socket activity of an executing process.
Kernel WFP Socket Classification
The Windows Filtering Platform (WFP) operates inside the kernel network stack (tcpip.sys). At the FWPM_LAYER_ALE_AUTH_CONNECT_V4 and FWPM_LAYER_ALE_AUTH_CONNECT_V6 layers, WFP intercepts every outbound connection attempt before any TCP SYN or UDP datagram reaches a network interface.
A hardened security architecture verifies the integrity of the process associated with every network socket:
- Dangling Process Verification: WFP callout drivers query the kernel for the executable path associated with the connecting process ID (
PID). - File System State Validation: If the binary path associated with the connecting process points to a non-existent or deleted file on disk, the callout driver classifies the socket as an orphaned ghost process and drops the connection immediately.
+-------------------------------------------------------------------------------+
| WIREGUARD & WFP KERNEL-LEVEL NETWORK CONTAINMENT |
+-------------------------------------------------------------------------------+
| |
| [Ghost Process (PID: 4812)] |
| | |
| |-- Winsock connect() to adversarial C2 server |
| v |
| [Windows Filtering Platform (WFP) Kernel Engine] |
| | |
| |-- Intercepts socket at FWPM_LAYER_ALE_AUTH_CONNECT |
| |-- Queries process file backing: File does not exist! |
| |-- Classifies as Unbacked/Ghost Process |
| | |
| +-----------------------+-----------------------+ |
| | | |
| [Default Physical Interface] [WireGuard Tunnel tun0] |
| | | |
| BLOCK & HARD DROP CRYPTOGRAPHIC ENCLAVE |
| (Kill-Switch Active) (Strict Egress Policy) |
| | |
| v |
| [Encrypted WireGuard Core] |
| [Noise IK / ChaCha20-Poly1305] |
+-------------------------------------------------------------------------------+
Encapsulation and Policy Enforcement with WireGuard
Deploying a system-wide WireGuard tunnel provides deterministic protection against the network fallout of stealthy process injection:
- Strict Kill-Switch Enforcement: By installing blocking WFP filters that drop all traffic escaping the virtual tunnel adapter (
wintun), malware running within a ghost process cannot communicate over raw physical network adapters. - Deterministic Cryptographic Encapsulation: WireGuard encapsulates all authorized packets using modern ChaCha20-Poly1305 authenticated encryption. Malicious payloads attempting out-of-band data exfiltration cannot forge packets outside the verified cryptographic tunnel.
- Centralized Egress Inspection: Because all outbound packets are forced through a private cryptographic tunnel to a secure gateway, enterprise network defenses can perform deep packet inspection, domain reputation filtering, and protocol anomaly detection on the decrypted stream in a controlled inspection enclave, completely detached from the compromised host environment.
Conclusion
Process Ghosting exposes the structural fragility of relying solely on host-level file inspection. By manipulating the delicate delete-pending state of Windows file handles, modern malware evades minifilter drivers and process creation callbacks with surgical precision.
When endpoint sensors fail to catch malicious code before execution, robust network-level architecture becomes the decisive defense. Combining kernel-level WFP socket validation with robust, connection-isolated WireGuard encryption ensures that even invisible processes remain contained and neutralized at the network perimeter.



