Modern endpoint detection and response (EDR) platforms rely heavily on kernel filesystem minifilter drivers (such as FLTMGR.SYS) and scanning hooks to intercept binaries before they execute in memory. By monitoring file creation, modification, and execution callbacks (PspCreateProcessNotifyRoutine), defenders attempt to verify digital signatures and scan payloads for malicious signatures. However, advanced adversaries exploit lower-level operating system subsystems to decouple the binary executing in volatile memory from what physically exists on the disk.
Process Doppelgänging is one of the most sophisticated process injection paradigms ever documented. First demonstrated by security researchers Tal Liberman and Eugene Kogan, this technique weaponizes the Windows Transactional NTFS (TxF) engine. By creating a transacted file, overwriting its data buffer with an unbacked executable, creating an in-memory section, and subsequently rolling back the transaction, malware completely conceals its payload from filesystem inspection. Even though the endpoint sensors perceive a benign, signed Windows binary, malicious code executes unhindered. To defeat these evasive mechanisms, defensive architectures must shift their focus to the network boundary, where cryptographically isolated WireGuard tunnels and deep egress telemetry strip away host-level camouflage.
+-------------------------------------------------------------------------------+
| PROCESS DOPPELGÄNGING EXECUTION PIPELINE VS WIREGUARD CONTAINMENT |
+-------------------------------------------------------------------------------+
| |
| [PHASE 1: TRANSACTED FILE MANIPULATION] |
| NtCreateTransaction() -> CreateFileTransactedW("svchost.exe") |
| * WriteFile(): Overwrite file buffer in transaction with malicious PE |
| | |
| v |
| [PHASE 2: SECTION CREATION & ROLLBACK] |
| NtCreateSection(SEC_IMAGE) -> Points to transacted memory buffer |
| * RollbackTransaction(): NTFS rolls back all modifications |
| * Disk State: Completely pristine, untouched, signed original svchost.exe |
| | |
| v |
| [PHASE 3: IN-MEMORY PROCESS INSTANTIATION] |
| NtCreateProcessEx() -> Instantiates process from uncommitted section |
| * RTL_USER_PROCESS_PARAMETERS spoofed to mimic legitimate system binary |
| * NtCreateThreadEx(): Execution begins without disk-level alert |
| | |
| v |
| [NETWORK EGRESS UNMASKING VIA WIREGUARD] |
| * Doppelgänger process initiates C2 beaconing (HTTP/3 or TLS 1.3) |
| * Kernel WireGuard Interface captures flow -> JA4 fingerprinting & isolation |
| * Stateful firewall policy quashes unauthorized outbound beaconing |
+-------------------------------------------------------------------------------+
The TxF Subversion: Exploiting NTFS Transactional Engine & Section Mapping
Transactional NTFS (TxF) was introduced by Microsoft to provide ACID (Atomicity, Consistency, Isolation, Durability) guarantees for filesystem operations. TxF enables applications to bundle multiple file updates into a single transaction, ensuring that either all operations succeed or none take effect. Process Doppelgänging subverts this transactional isolation mechanism through a surgical sequence of low-level Windows Native API calls:
[NtCreateTransaction] -> [CreateFileTransactedW on target binary]
|
v
[WriteFile: Inject malicious PE into transacted file stream]
|
v
[NtCreateSection: Request SEC_IMAGE from transacted file handle]
|
v
[RollbackTransaction: Revert disk state via TxF manager]
- Transaction Initialization: The attacker creates a new transaction object via
NtCreateTransactionor the Win32CreateTransactionwrapper:HANDLE hTransaction = CreateTransaction(NULL, 0, 0, 0, 0, 0, L"TxF_Payload"); - Transacted File Handle Acquisition: The attacker opens a target legitimate binary (typically a trusted Microsoft executable like
svchost.exeornotepad.exe) usingCreateFileTransactedW:HANDLE hTransactedFile = CreateFileTransactedW( L"C:\\Windows\\System32\\svchost.exe", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL, hTransaction, NULL, NULL ); - Payload Overwrite: The payload's raw Portable Executable (PE) headers and sections are written directly into the transacted file handle. At this stage, the modifications exist purely within the TxF isolation cache managed by
txf.sysand the NTFS driver. - Section Object Instantiation: The operating system kernel is invoked to create a memory section object (
SEC_IMAGE) backed by the transacted file:
Crucially, the Windows memory manager validates the PE structure, resolves section alignments, and sets up page protections based on the malicious payload loaded in the transacted buffer.HANDLE hSection = NULL; NtCreateSection(&hSection, SECTION_ALL_ACCESS, NULL, 0, PAGE_READONLY, SEC_IMAGE, hTransactedFile);
Execution Without Persistence: Transaction Rollback & EDR Minifilter Blindness
The defining operational advantage of Process Doppelgänging lies in the transaction rollback phase. Once the memory manager creates the section handle hSection, the physical backing file on disk is no longer required:
RollbackTransaction(hTransaction);
CloseHandle(hTransactedFile);
CloseHandle(hTransaction);
When RollbackTransaction executes:
- The NTFS filesystem immediately discards all cached modifications.
- The physical disk clusters representing
svchost.exenever receive a single byte of malicious code. - Traditional antivirus and EDR filesystem minifilters (registered with the Filter Manager
fltmgr.sys) monitorIRP_MJ_CREATE,IRP_MJ_WRITE, andIRP_MJ_CLEANUP. Because the transaction is rolled back before completion, noIRP_MJ_CLOSEwith committed data ever reaches the disk. - If a security scanner attempts to read
C:\Windows\System32\svchost.exe, it reads the authentic, cryptographically signed binary issued by Microsoft.
+-------------------------------------------------------------------------------+
| MINIFILTER BLIND SPOT: TRANSACTION ROLLBACK VS PHYSICAL DISK STATE |
+-------------------------------------------------------------------------------+
| |
| Malware Action: [ Write Malicious Payload to Transacted Cache ] |
| | |
| Section Creation: [ Kernel Section Object Maps Payload into Memory ] |
| | |
| Rollback Action: [ RollbackTransaction() Discards Write Cache ] |
| | |
| Disk Inspection: [ EDR Minifilter reads disk -> Valid Microsoft Signature ]|
| Memory Execution: [ Thread executes uncommitted malicious code ] |
+-------------------------------------------------------------------------------+
Memory-Disk Desynchronization: PEB Masquerading & Process Initialization
With an executable section object floating in kernel space completely detached from physical storage, the adversary instantiates the new process using unexported native APIs:
1. Process Creation via NtCreateProcessEx
Instead of relying on high-level APIs like CreateProcessW (which enforce disk validation), the malware invokes NtCreateProcessEx:
HANDLE hProcess = NULL;
NtCreateProcessEx(&hProcess, PROCESS_ALL_ACCESS, NULL, GetCurrentProcess(), 0, hSection, NULL, NULL, FALSE);
The kernel constructs the process address space using the payload's image layout. However, because NtCreateProcessEx performs minimal initialization, the Process Environment Block (PEB) and process parameters must be manually constructed.
2. Crafting Fake Process Parameters
To trick administrative tools (like Process Explorer and Task Manager), the attacker creates a spoofed RTL_USER_PROCESS_PARAMETERS structure:
PRTL_USER_PROCESS_PARAMETERS pProcessParameters = NULL;
UNICODE_STRING uImagePath, uCommandLine, uCurrentDir;
RtlInitUnicodeString(&uImagePath, L"C:\\Windows\\System32\\svchost.exe");
RtlInitUnicodeString(&uCommandLine, L"C:\\Windows\\System32\\svchost.exe -k netsvcs");
RtlInitUnicodeString(&uCurrentDir, L"C:\\Windows\\System32");
RtlCreateProcessParametersEx(&pProcessParameters, &uImagePath, NULL, &uCurrentDir, &uCommandLine, NULL, NULL, NULL, NULL, NULL, RTL_USER_PROC_PARAMS_NORMALIZED);
The attacker allocates memory in the remote process, writes the spoofed parameters, and updates the ProcessParameters pointer inside the remote PEB.
3. Thread Creation & Execution Kickoff
Finally, the entry point of the payload is determined from the PE headers, and execution begins:
HANDLE hThread = NULL;
NtCreateThreadEx(&hThread, THREAD_ALL_ACCESS, NULL, hProcess, (LPTHREAD_START_ROUTINE)pRemoteEntryPoint, NULL, FALSE, 0, 0, 0, NULL);
To user-mode monitoring agents, the running process presents the name, path, icon, and command-line arguments of a legitimate Windows service host.
Network-Layer Containment: Unmasking Ghost Processes with WireGuard Egress Telemetry
While Process Doppelgänging achieves near-perfect evasion against endpoint file scanners and static image validators, it cannot escape the physical reality of network egress. To execute its operational objectives—such as credential exfiltration, lateral movement, or interactive command execution—the Doppelgänger process must establish outbound communication with its Command and Control (C2) server.
Relying exclusively on host-based agent telemetry is insufficient when the operating system's internal reporting structures have been blinded. An impenetrable defensive perimeter requires decoupling network visibility from the compromised host through a dedicated WireGuard gateway.
+-------------------------------------------------------------------------------+
| ISOLATED WIREGUARD EGRESS TELEMETRY & BEACON CONTAINMENT MODEL |
+-------------------------------------------------------------------------------+
| |
| [HOST ENVIRONMENT (COMPROMISED)] |
| Doppelgänger Process (Masked as svchost.exe) |
| * Evades host EDR via TxF Section Desync |
| * Attempts outbound socket connection: 198.51.100.24:443 |
| | |
| v (Kernel WireGuard Interface) |
| [WIREGUARD TUNNEL: CRYPTOGRAPHIC ENCAPSULATION] |
| ChaCha20-Poly1305 Encrypted UDP Transport -> Routed to Network Gateway |
| | |
| v |
| [SECURITY GATEWAY & EGRESS ANALYZER] |
| * JA4 / JA4S TLS Fingerprint Analysis: Detects non-standard handshake |
| * Behavioral C2 Beacon Detection: Statistical inter-arrival jitter analysis |
| * nftables Strict Egress Policy: Blocks unapproved outbound endpoints |
| | |
| RESULT: C2 Channel Quarantined; Host Isolated from Corporate Backbone |
+-------------------------------------------------------------------------------+
1. Hardening Network Namespace and Policy Routing
On the endpoint, binding all outbound traffic to a strictly enforced WireGuard tunnel ensures that even masked processes cannot transmit raw packets past network monitoring. On Linux or BSD-based security gateways, the traffic is subjected to strict stateful firewall inspection:
# nftables configuration for strict C2 egress containment
table inet filter {
chain egress_containment {
type filter hook output priority 0; policy drop;
# Allow established and related traffic
ct state established,related accept
# Allow WireGuard encapsulation traffic on port 51820
udp dport 51820 accept
# Allow authenticated DNS requests to corporate resolver only
ip daddr 10.88.0.1 udp dport 53 accept
ip daddr 10.88.0.1 tcp dport 53 accept
# Reject direct IP connections from masqueraded system binaries
log prefix "UNAUTHORIZED_C2_ATTEMPT: " drop
}
}
2. Behavioral C2 Beaconing and JA4 Fingerprinting
Because the malware's payload cannot inherit legitimate Microsoft TLS configuration profiles when using custom socket libraries, the gateway's egress analyzer flags anomalies:
- JA4 TLS Fingerprint Mismatch: While a genuine
svchost.exeprocess uses standard Windows Schannel TLS client hellos, custom Doppelgänger implants (such as Cobalt Strike, Havoc, or custom Golang loaders) present distinctive cipher suite orderings and TLS extension lists. - Beaconing Jitter Analysis: The gateway calculates the entropy and variance of connection intervals. Regular or slightly jittered heartbeats directed to untrusted external ASNs trigger automated quarantine actions.
Defensive Posture Comparison: Traditional EDR vs. Network WireGuard Defense
| Evaluation Metric | Traditional Host-Based EDR | Hardened WireGuard Network Gateway |
|---|---|---|
| Filesystem Minifilter Inspection | Blossumed by TxF Rollback | Agnostic to host disk manipulations |
| Process Memory Validation | Duped by SEC_IMAGE backed mapping |
Monitors unalterable network socket egress |
| PEB and Command-Line Spoofing | Relies on spoofable userland structures | Evaluates raw Layer 3 / Layer 4 traffic flows |
| TLS Fingerprint Verification | Often blind to memory-injected sockets | Decoupled JA4 inspection at tunnel egress |
| Containment Velocity | Delayed until heuristic threshold trips | Immediate cryptographic cutoff at gateway |
Process Doppelgänging illustrates the inherent fragility of relying solely on host-level operating system telemetry. When memory management and filesystem transactions can be manipulated to produce phantom processes, true security resilience is achieved by verifying behavior at the network boundary. Routing all endpoint communications through high-performance WireGuard tunnels restores unambiguous visibility and provides dependable protection against the most elusive evasion techniques.



