Spoofing Commands - Can You Trust Process Creation Logs?
Tristan (Co-founder · Seamless Intelligence)
BSides Canberra VII (2024) · Day 3 · Main Track
Overview
In the realm of cybersecurity, the integrity of logs is paramount for effective incident response and threat detection. However, a persistent technique known as command line spoofing challenges this fundamental assumption, allowing attackers to execute malicious commands while Windows logs an entirely different, benign-looking command line. Tristan, Co-founder of Seamless Intelligence, delivered a compelling talk at BSides Canberra, "Spoofing Commands - Can You Trust Process Creation Logs?", exposing the continued efficacy of this three-year-old technique across all versions of Windows and its significant implications for modern security operations.

Key moments
- 0:40 Initial problem: can you trust process creation logs?
- 16:00 Technical deep dive: how command line spoofing works
- 22:00 Crucial logging issue: trailing spaces are stripped
- 24:00 Real-world example: hiding LSASS dumps with Multi-dump
- 34:00 Attackers' advantage: built-in Windows tools are undetectable
- 42:00 EDR evasion: student project bypasses Defender xdr
- 50:00 Microsoft's stance: MSRC says technique not immediate servicing
Spoofing Commands - Can You Trust Process Creation Logs?
Speakers: Tristan, Co-founder, Seamless Intelligence
Conference: BSides Canberra
YouTube: https://www.youtube.com/watch?v=lPHDDnxlsZY
Overview
In the realm of cybersecurity, the integrity of logs is paramount for effective incident response and threat detection. However, a persistent technique known as command line spoofing challenges this fundamental assumption, allowing attackers to execute malicious commands while Windows logs an entirely different, benign-looking command line. Tristan, Co-founder of Seamless Intelligence, delivered a compelling talk at BSides Canberra, "Spoofing Commands - Can You Trust Process Creation Logs?", exposing the continued efficacy of this three-year-old technique across all versions of Windows and its significant implications for modern security operations.
Tristan's presentation meticulously details how this technique manipulates the Process Environment Block (PEB) to trick Windows into logging a false command line during process creation. This deception can lead security analysts down misleading paths, making it exceptionally difficult to ascertain the true nature of an attack, especially when combined with EDR bypasses or privilege escalation techniques. The research from Seamless Intelligence, which has garnered bug bounties from industry giants like CrowdStrike and Microsoft, underscores the critical gap this technique exploits in both native Windows logging and many Endpoint Detection and Response (EDR) solutions.
The talk not only dissects the technical mechanics of command line spoofing but also demonstrates its real-world impact through various proof-of-concept scenarios. It highlights how attackers can leverage this method to hide the execution of common red-teaming tools like Rubius or even the dumping of LSASS, making traditional command-line based detections largely ineffective. For defenders, understanding this vulnerability is crucial, as it necessitates a shift in focus from solely relying on process creation logs to a more holistic approach incorporating other logging sources and behavioral analysis.
Background
▶ Watch: Initial problem: can you trust process creation logs? (0:40)
The concept of command line spoofing isn't new; Tristan notes that the technique is at least three years old, with its origins potentially tracing back to a Cobalt Strike addition designed to alter logs post-execution. The specific tool "command line spoofer" (CLS), which forms the core of Tristan's analysis, emerged around that time and significantly refined the method. Despite its age, the technique remains remarkably effective across all versions of Windows, a testament to a fundamental architectural characteristic of how Windows logs process creation.
The core problem stems from a semantic distinction: Windows logs process creation, not process running. When a process is initiated, the operating system records the initial state of its Process Environment Block (PEB), which includes the command line used to launch it. Crucially, this PEB is a user-mode structure, meaning the memory addresses it references can be overwritten by the user who starts the process. This critical detail means that a low-privileged user can manipulate the PEB's command line string after Windows has logged the initial (spoofed) command but before the process actually executes the malicious payload. This technique does not inherently grant privilege escalation; it merely obfuscates activity, allowing an attacker to run as a normal user and hide their actions.
While potent, command line spoofing has limitations. It doesn't prevent EDR solutions from inspecting the behavior of a process, even if the command line is hidden. For instance, an EDR might still detect an LSASS dump based on the API calls made, even if the command line that initiated it is spoofed. Furthermore, as the talk explores, not all commands are equally hidden. Certain types of logging, particularly Powershell Module Logging (Event ID 800s), can still capture the true intent of Powershell commands, even when the initial process creation log is compromised. However, the pervasive reliance on command line parameters for detection rules and incident response investigations makes this technique a significant threat vector, as it directly undermines the trustworthiness of what is often considered a primary source of truth.
Key Findings
▶ Watch: Crucial logging issue: trailing spaces are stripped (22:00)
Tristan's research reveals several critical findings regarding the pervasive nature and impact of command line spoofing:
- Universal Logging Vulnerability: The most striking finding is that all primary Windows logging mechanisms are susceptible. This includes native Windows Security Event ID 4688 (Process Creation), Sysmon Event ID 1 (Process Create), and Defender for Endpoint's device process events. In each case, these logs will record the spoofed, benign command line rather than the actual malicious command executed. This fundamentally undermines the reliability of these logs for command-line-based detections and forensic analysis.
- PEB Manipulation via Suspended Processes: The technique's efficacy hinges on creating a process in a suspended state (
CREATE_SUSPENDEDflag). This allows the attacker to launch a process, have Windows log its initial (spoofed) command line from the PEB, and then, before the process begins execution, overwrite the PEB's command line memory with the true malicious command. This manipulation occurs in user space and does not require elevated privileges.
- The Problem of Trailing Spaces: The command line spoofer pads the spoofed command with spaces to ensure sufficient memory is allocated for the later injection of the malicious command. Intriguingly, when these logs are exported from Windows (e.g., in XML format for SIEM ingestion), trailing spaces are often stripped. This seemingly innocuous behavior inadvertently aids attackers by removing a potential indicator (a long string of spaces) that defenders might otherwise use to identify spoofed commands.
- Mixed EDR Coverage and Bypass Potential: EDR solutions exhibit inconsistent detection capabilities against this technique. While some top-tier EDRs detected the underlying technique (process starting in a suspended state, memory overwrite, resume thread), others failed to do so. A custom-rewritten version of the spoofer, dubbed "invis run" by one of Tristan's students, successfully bypassed an EDR that had previously detected the original command line spoofer. This highlights the ongoing cat-and-mouse game and the challenge for EDR vendors to detect generic memory manipulation techniques without generating excessive false positives. Notably, Microsoft Defender for Endpoint detected the original CLS as "Rosina malware" (a generic Trojan family), but the
invis run V2went completely undetected in a fully remediated Defender XDR environment.
- Differential Detectability of Command Types: The talk meticulously differentiates between command types:
- Composite Commands (e.g.,
powershell.exe -enc whoami): While the initialpowershell.execommand line might be spoofed, the subsequent actions (likewhoami) can often be captured by Powershell Module Logging (Event ID 800s) if enabled. This means the end result is often still visible, albeit with a missing link in the process chain. - Pure Powershell Cmdlets (e.g.,
Set-MpPreference -ExclusionPath ...): Command line spoofing is highly effective here, as native Windows process creation logs will only show the spoofed command. However, Powershell Module Logging (Event ID 800s) is a critical countermeasure, as it logs the full, decoded Powershell command, regardless of the spoofed parent process command line. - Built-in Windows Tools (
netsh,certutil,msbuild,vssadmin,reg): This category presents the most significant blind spot. When these tools are used with command line spoofing, the entire execution chain for that specific process is hidden. The PEB's image name must still match the spoofed command (e.g., ifnetshis the malicious tool,netshmust also be the spoofed command), but all parameters are completely obfuscated. There is no native Windows logging mechanism that reliably captures the true command for these tools when spoofed, making them an attacker's ideal target.
- Microsoft's Acknowledgment and Stance: Tristan submitted a proof-of-concept for this issue to the Microsoft Security Response Center (MSRC) in February 2024. While MSRC acknowledged the POC's validity, they stated it "doesn't cross a security boundary" and "doesn't meet the current bar for immediate servicing." This indicates that, for the foreseeable future, defenders cannot rely on a native fix from Microsoft to address this logging gap.
Technical Deep Dive
▶ Watch: Real-world example: hiding LSASS dumps with Multi-dump (24:00)
At the heart of command line spoofing lies a sophisticated manipulation of the Windows process creation mechanism, specifically targeting the Process Environment Block (PEB). The PEB is a fundamental data structure in Windows, residing in user-mode memory, that holds crucial information about a running process, including its command line arguments.
When Windows initiates a new process, it performs a series of steps. A critical one is calling NTCreateUserProcess, which initializes the contents of the PEB. It is at this point that Windows logging mechanisms, such as Event ID 4688, Sysmon Event ID 1, and Defender's device process events, capture the initial command line string from the PEB. The crucial insight exploited by command line spoofing is that the user who owns a process can overwrite memory locations within its own PEB. This means that the command line string, once logged, can be altered before the process actually executes its intended function.
The "command line spoofer" tool leverages this by employing a three-step process:
- Suspended Creation: The malicious process is initially created using the
CREATE_SUSPENDEDflag. This critical flag ensures that the process is initialized, and its initial PEB (containing the spoofed command line) is logged by Windows, but its primary thread is paused before any code execution can occur. This is the window of opportunity for manipulation. Tristan noted that he found it "quite interesting" that he couldn't dump the memory of a suspended process using common tools like ProcDump, Task Manager, or Process Explorer, suggesting a potential anti-analysis side effect or artifact.
- PEB Manipulation: Once suspended, the spoofer code locates the PEB in the newly created process's memory space. It then reads the necessary memory addresses to pinpoint where the command line argument is stored. The
spoof_commandstring, which is typically a benign-looking command (e.g., "powershell MST teams update") padded with a large number of spaces, is used during the initial process creation. The padding is crucial to ensure that sufficient memory is allocated for the actualmalicious_commandthat will be injected later. Without adequate padding, the malicious command might overflow the allocated buffer. After the initial logging, the spoofer directly overwrites the command line string within the PEB with the true, malicious command (e.g., an encoded Powershell Empire beacon).
- Resuming Execution: Finally, the spoofer resumes the suspended thread of the manipulated process. At this point, the process executes the malicious command, but all prior Windows logs for its creation will reflect the benign, spoofed command line. Even tools like Process Monitor (Procmon) will display the padded, incorrect command line throughout the entire lifecycle of the process, demonstrating the deep-seated nature of this deception.
Tristan presented a simplified view of the command line spoofer's source code, highlighting the elegance of its implementation. The core logic involves defining a malicious_command (e.g., an encoded C2 beacon) and a spoof_command (e.g., "powershell" padded with spaces). The spoof_command must match the executable name of the malicious command being run (e.g., if running netsh, the spoofed command must also start with netsh). The code then uses Windows API calls to create the process suspended, read the PEB, overwrite the command line, and finally resume the thread. This entire process, as Tristan noted, can be achieved with a surprisingly small amount of code, perhaps around 80 lines excluding includes.
A critical observation regarding logging is the behavior of trailing spaces. When Windows security logs are exported, particularly in XML format, many logging systems or parsers will strip trailing spaces from string fields. This means that the intentional padding used by the spoofer to reserve memory space—which could otherwise be a detectable artifact—disappears by the time the logs reach a Security Information and Event Management (SIEM) system like Sentinel. This effectively cleans up the attacker's tracks, making detection based on unusual command line length or trailing characters extremely difficult.
Demo / Proof of Concept
▶ Watch: EDR evasion: student project bypasses Defender xdr (42:00)
Tristan's presentation included practical demonstrations on two Windows 2016 servers, showcasing the technique's effectiveness against various scenarios.
Scenario 1: Standard Rubeus Execution
Tristan first demonstrated a standard execution of Rubeus.exe for Kerberoasting. This resulted in expected detections, both for the Rubeus.exe process name and for specific Kerberoasting command line parameters. This established a baseline for how normal malicious activity would be logged and detected.
Scenario 2: Renamed nobius Execution
To illustrate a basic evasion technique, Tristan renamed rubeus.exe to nobius.exe and executed it. While this bypassed detections explicitly looking for Rubeus.exe by name, the malicious command line parameters were still logged, leading to a detection based on "suspicious command line parameters" associated with Kerberoasting. This highlighted that simple renaming is often insufficient for sophisticated evasion.
Scenario 3: CLS with netsh (Built-in Tool)
This demonstration showcased a significant blind spot. Tristan used a CLS executable to launch netsh.exe with a malicious command to add a firewall rule (e.g., netsh advfirewall firewall add rule name="Allow Remote Desktop Hacker" ...). The spoofed command line, however, was netsh MS Teams update (padded with spaces). The firewall rule was successfully added, but the logs only showed the benign "MS Teams update" command. No detection fired for the actual rule creation. This illustrated how built-in Windows utilities, often considered benign, can be completely hidden using this technique, making discovery commands or system changes undetectable via command line logging.
Scenario 4: CLS with Powershell Kerberoasting
Tristan then demonstrated using CLS to execute an encoded Powershell command that performed Kerberoasting on a single account. The spoofed command line again appeared as powershell.exe MST teams update. While the Kerberoasting successfully occurred, and traditional command line logs showed only the spoofed command, Powershell Module Logging (Event ID 800s) provided crucial visibility. This log captured the full, decoded Powershell command, including the import of the System.IdentityModel assembly, which is a strong indicator of Kerberoasting activity by a normal user. This highlighted the importance of enabling Powershell Module Logging as a critical countermeasure.
multi-dump Example
Tristan referenced the multi-dump tool, which integrates command line spoofing to dump LSASS. The tool would spoof its command line to something like rundll32.exe open optimization panel clean up temp files, while actually performing an LSASS dump using rundll32. While EDR products did detect the behavioral anomaly of an LSASS dump, the reported command line in their logs was the incorrect, spoofed version. This could lead to confusion for analysts, potentially attributing it to legitimate Windows processes.
invis run and EDR Bypasses
A highlight of the demo section was the discussion of "invis run," a rewritten version of the command line spoofer developed by one of Tristan's students. This tool, using slightly different memory manipulation and padding techniques, achieved an unexpected EDR bypass. While the original CLS was detected by Microsoft Defender for Endpoint as "Rosina malware" (a generic Trojan), invis run V2 was not detected at all, even in a fully configured Defender XDR environment. This underscores the dynamic nature of EDR evasion and the continuous need for research.
dotPeek for Reverse Engineering
Tristan briefly demonstrated using dotPeek to reverse engineer a .NET executable compiled with the spoofer. This showed how an analyst could inspect a suspicious binary and discover the embedded encoded Powershell command, revealing the attacker's true intent even if the command line was spoofed.
Defensive Implications
▶ Watch: Microsoft's stance: MSRC says technique not immediate servicing (50:00)
Given the persistent efficacy of command line spoofing and Microsoft's current stance, defenders must adopt a multi-layered approach to mitigate its impact. Relying solely on process creation logs is no longer sufficient.
- Enable Command Line Logging for Event ID 4688: While vulnerable to spoofing, enabling command line logging for Windows Security Event ID 4688 is still a fundamental step. Without it, even un-spoofed command lines are not captured, rendering process creation logs almost useless. This setting is not on by default and must be explicitly configured via Group Policy.
- Prioritize Powershell Module Logging (Event ID 800s): For Powershell-based attacks, this is arguably the most critical defensive measure. Powershell Module Logging captures the full, decoded Powershell commands, including cmdlets, parameters, and even script block contents, irrespective of any command line spoofing on the parent process. While it can generate high volumes of logs, especially in environments with extensive Powershell usage, the visibility it provides is invaluable. Other Powershell logging options like script block logging (Event ID 4104) are also highly recommended.
- Deploy and Configure Sysmon Effectively: Sysmon (System Monitor) provides enriched process creation events (Event ID 1) with additional metadata like hashes, original file names, and parent process information. While Sysmon's process creation event is also vulnerable to command line spoofing, its other event types can be crucial. For instance, Sysmon Event ID 12/13 (Registry Event) can detect modifications to sensitive registry keys (like
WDigestfor plaintext password storage) that might be initiated by spoofedreg.execommands. However, Sysmon requires careful configuration with a robust config file to avoid excessive noise and ensure relevant events are logged.
- Focus on Post-Creation Artifacts and Behavioral Analysis: Since the initial process creation log can be misleading, defenders must shift their detection logic to look for subsequent actions and behavioral indicators.
- Registry Changes: Monitor for suspicious registry modifications (e.g., using Sysmon or dedicated registry monitoring tools).
- Network Connections: Correlate process activity with network connections. A spoofed
netshcommand might hide the firewall rule change, but the subsequent C2 communication will still be visible. - File System Changes: Track suspicious file creations, modifications, or deletions.
- Specific Module/Assembly Imports: As shown in the Kerberoasting demo, detecting the import of specific .NET assemblies like
System.IdentityModelin Powershell Module Logs can be a high-fidelity indicator. - API Call Monitoring: EDR solutions that monitor low-level API calls can still detect the behavior of an LSASS dump or other malicious actions, even if the command line is spoofed.
- Be Wary of Built-in Tools:
netsh,certutil,msbuild,vssadmin, andreg.exeare particularly dangerous when combined with command line spoofing because their usage can be completely hidden from command line logs. Defenders should establish baselines for legitimate usage of these tools and prioritize monitoring their effects (e.g., firewall rule changes, certificate operations, volume shadow copy creation, registry modifications) rather than solely relying on command line parameters.
- Layered Security and EDR Limitations: The mixed EDR coverage highlights that no single security product is a silver bullet. EDRs are a vital layer, but they are not infallible, especially against sophisticated memory manipulation techniques. Relying on a combination of EDR, robust logging, SIEM correlation, and behavioral analytics is essential. Defenders should treat EDR detections as one piece of the puzzle, always cross-referencing with other available logs and contextual information.
- Educate Analysts: Security analysts must be aware of command line spoofing. They should be trained to question seemingly benign command lines, especially when other indicators suggest malicious activity, and to pivot to other log sources (like Powershell Module Logs or Sysmon events) for verification.
Key Takeaways
- Process creation logs (Windows Event ID 4688, Sysmon Event ID 1, Defender device process events) are vulnerable to command line spoofing and cannot be fully trusted for command line accuracy.
- The technique leverages user-mode manipulation of the Process Environment Block (PEB) in suspended processes, allowing attackers to inject malicious commands after the initial, spoofed command line has been logged.
- Enabling Powershell Module Logging (Event ID 800s) is a critical defensive measure, as it captures full, decoded Powershell commands even when the parent process's command line is spoofed.
- **Built-in Windows tools like
netsh,certutil,msbuild,vssadmin, andreg.exeare particularly susceptible to this technique, as their malicious usage can be completely hidden from command line logs, requiring defenders to monitor their effects rather than their arguments.** - EDR solutions show mixed detection capabilities against command line spoofing, emphasizing the need for a layered security approach that combines EDR with comprehensive logging and behavioral analysis.
- Microsoft has acknowledged the issue but does not currently plan to fix this logging behavior, meaning defenders must implement their own mitigations.
About the Speaker(s)
Tristan is a Co-founder at Seamless Intelligence, where he is actively involved in running a Security Operations Center (SOC) and conducting extensive research into attacker tools and techniques. His work focuses on improving detection capabilities and identifying new methods used by adversaries. Tristan's expertise in this area has been recognized through bug bounties awarded by leading cybersecurity companies like CrowdStrike and Microsoft for uncovering EDR bypasses and identifying Windows vulnerabilities. He is also credited with three technique attributions to the MITRE ATT&CK framework, showcasing his contributions to the broader security community's understanding of attacker methodologies. Tristan maintains a GitHub repository where he shares the tools and proof-of-concept executables from his research, including the command line spoofer demos, enabling others to compile and test these techniques.
Reviews
- Heather Calloway (CISO) — MUST SEE ★★★★★