Catching WMI lateral movement in an enterprise network
Jaco Blokker (Security Analyst · KPN)
BruCON 0x0B · Day 1
Overview
In this BruCON 2019 presentation, Jaco Blokker, a seasoned Security Analyst at KPN, delves into the critical challenge of detecting Windows Management Instrumentation (WMI) lateral movement within an enterprise network. The talk stemmed from a frustrating incident where KPN's red team successfully leveraged WMI to compromise domain controllers without triggering any existing network-level detections. This highlighted a significant gap in conventional security monitoring, as most WMI detection efforts typically focus on endpoint telemetry rather than network traffic.

Key moments
- 0:00 Missing red team WMI attack; project motivation
- 6:00 WMI capabilities and defender's detection challenge
- 11:30 Refining detection with RPC context (interface, opnum)
- 16:00 Red team testing failure; shifting to server-side WMI spec
- 18:00 Developing 'golden rule' and failed WMI login detection
- 29:00 Proactively assessing false negatives via WMI authentication levels
- 36:00 Lab testing with encryption reveals new rule opportunities
- 41:00 Q&A: Distinguishing legit traffic and inspecting WMI commands
Catching WMI lateral movement in an enterprise network
Speakers: Jaco Blokker, Security Analyst, KPN
Conference: BruCON
YouTube: https://www.youtube.com/watch?v=f67CHOj7OrY
Overview
In this BruCON 2019 presentation, Jaco Blokker, a seasoned Security Analyst at KPN, delves into the critical challenge of detecting Windows Management Instrumentation (WMI) lateral movement within an enterprise network. The talk stemmed from a frustrating incident where KPN's red team successfully leveraged WMI to compromise domain controllers without triggering any existing network-level detections. This highlighted a significant gap in conventional security monitoring, as most WMI detection efforts typically focus on endpoint telemetry rather than network traffic.
Blokker's research details KPN's journey to develop a robust, network-based WMI detection ruleset for their Snort-based platform. Faced with a lack of readily available network signatures, KPN opted to build their own, culminating in a publicly released set of Snort rules. The presentation meticulously unpacks their methodology, from initial protocol analysis and rule development to extensive testing with both legitimate administrative tools and attacker frameworks like Impacket.
The talk underscores the importance of understanding underlying protocols, collaborating across security and operational teams, and proactively assessing detection efficacy against various evasion techniques, including different WMI authentication levels. By sharing their findings and the open-source ruleset, KPN aims to empower the broader security community to enhance their defenses against a persistent and stealthy lateral movement technique widely adopted by advanced threat actors, as cataloged in the MITRE ATT&CK framework.
Background
▶ Watch: Missing red team WMI attack; project motivation (0:00)
The impetus for KPN's research into WMI network detection arose from a sobering realization: their existing security controls, specifically their Snort-based detection platform, completely missed a red team attack that utilized WMI for lateral movement against their domain controllers. This incident exposed a critical blind spot, as traditional network intrusion detection systems (NIDS) lacked the necessary signatures to identify WMI abuse. While endpoint detection solutions often provide visibility into WMI activity, network-level visibility was scarce, leaving a gap that attackers could readily exploit.
WMI itself has a long history, originating in the mid-1990s from collaborative efforts between Microsoft and Cisco to standardize IT environment management under the umbrella of Web-Based Enterprise Management (WBEM). This initiative was closely tied to the Common Information Model (CIM), which provides specifications for schemas, naming conventions, and relationships between machine components. Microsoft's implementation, Windows Management Instrumentation (WMI), quickly became a core OS component, available since Windows NT and integral to Windows 2000 and subsequent versions. WMI offers powerful capabilities to read, write, and execute remote commands and objects, granting remote administrative access by default to members of the local administrator group. Although recent Windows versions block WMI by default on host-based firewalls, its prevalence and inherent power make it an attractive target for attackers.
Crucially, the talk focuses on WMI transport over RPC/DCOM (Remote Procedure Call / Distributed Component Object Model). While modern WMI can also use Web Services Management (WS-Management) implemented as Windows Remote Management (WinRM), RPC/DCOM remains a legacy but widely used transport mechanism, often less constrained by firewalls due to its deep integration with Windows networking. This makes it a prime target for lateral movement.
From a defender's perspective, WMI presents a unique challenge. Its status as a core OS component means attackers don't need to introduce external tools, making their activity harder to distinguish from legitimate administrative tasks. The MITRE ATT&CK framework explicitly lists WMI as a technique (T1047) used by numerous threat actors for execution, lateral movement, and persistence. KPN's monitoring objectives were therefore clear: to determine the feasibility of network-level WMI detection, specifically focusing on non-legitimate traffic rather than vulnerability detection, and to ensure that any triggered alerts could provide rich, actionable data such as the source, credentials used, and executed commands.
Key Findings
▶ Watch: Refining detection with RPC context (interface, opnum) (11:30)
The research yielded several significant findings, shaping KPN's approach to WMI detection:
- Initial Detection Challenges: A straightforward approach of searching for the Object Exporter ID Resolver UUID on port 135 (RPC End-mapper) proved too broad, leading to high false positive risks due to lack of context.
- Contextual RPC Rule Development: By understanding the structure of RPC function calls, KPN refined their rules to target specific elements like the interface number (i-face), operational number (opnum) representing the method, and stub data. This significantly improved accuracy and readability.
- Policy-Based Whitelisting: Initial attempts to distinguish legitimate from malicious traffic involved collaborating with system administrators to define approved source machines for WMI administration. This policy-based approach provided a blueprint for initial whitelisting but carried the risk of false positives if administrative practices changed without notification.
- Red Team Validation and Blind Spots: Engaging the red team for re-testing revealed critical blind spots. While Windows clients (e.g., PowerShell) triggered the rules as expected, Linux clients leveraging open-source libraries like Impacket did not. This highlighted the need to account for diverse attacker tooling.
- Server-Side Authoritative Source: The failure to detect Impacket activity shifted the focus from client-side behavior to server-side expectations. Consulting the Microsoft Developer Network (MDN) WMI protocol specification proved crucial. It mandated that clients must call the IWbemLevel1Login::NTLMLogin method, which is uniquely identified by a specific UUID and
opnum6. This led to the development of a highly reliable "golden rule." - Failed Attempt Detection: Detection of brute-force or failed WMI access attempts was achieved by analyzing server responses. Specifically, a fault packet containing error code 5 (access denied) at a specific offset (byte 24, length 4) was identified as a reliable indicator. This rule required iterative tweaking and was recommended for use with a threshold.
- Impact of Authentication Levels: Testing revealed that WMI authentication levels, particularly Packet Privacy (which enforces encryption), significantly alter network traffic patterns. While the "golden rule" worked reliably under default
Connectauthentication, it failed to trigger when full encryption was enforced. This necessitated the development of additional rules to cover encrypted WMI traffic, demonstrating a potential evasion technique. - Cross-Team Collaboration is Key: The success of the project was heavily attributed to effective collaboration with both system administrators (for defining legitimate WMI usage) and the red team (for realistic testing and uncovering blind spots). This collaboration also raised awareness among administrators about the importance of WMI detection.
- Open-Sourcing for Community Benefit: KPN decided to release their developed Snort ruleset to the public, recognizing that collective effort and community feedback would lead to further improvements.
Technical Deep Dive
▶ Watch: Developing 'golden rule' and failed WMI login detection (18:00)
KPN's journey to detect WMI lateral movement involved a meticulous, iterative process of protocol analysis, rule development, and rigorous testing. The initial challenge was the lack of network-level WMI signatures, forcing a ground-up approach.
The team's starting point was simple: executing a Get-WmiObject command from the Windows Management Framework, targeting a remote system to run ipconfig.exe with invalid credentials. Packet captures revealed that the client first connects to port 135, the RPC End-mapper port. This initial connection targets an interface known as the Object Exporter ID Resolver, identified by a unique UUID (Universally Unique Identifier) – a 128-bit number. This resolver handles RPC bookkeeping and garbage collection. Jaco Blokker initially considered this UUID a promising starting point for a rule, but quickly recognized its limitations. A rule solely based on this UUID, searching for the byte sequence anywhere in the payload, would generate excessive false positives due to its lack of RPC context.
To add context, the team delved into the anatomy of an RPC function call. When a client calls a function (or method), parameters are passed to a stub, which handles data conversion between the client and server's address spaces before placing the data "on the wire." The server then reverses this process. To detect specific RPC calls, an IDS needs to look for:
- The i-face (interface number): A unique identifier for the RPC interface being used.
- The opnum (operational number): A specific number corresponding to the method being called within that interface.
- The stub data: The actual parameters and data associated with the method call.
By mapping these elements, the team transformed their initial, broad rule into a more precise one. For example, a rule segment might look for a specific UUID (the interface identifier) followed by a specific opnum (e.g., 06 00 00 00 for opnum 6). This approach not only improved accuracy but also simplified rule writing by abstracting away concerns about endianness, as the interface identifier could be presented in either little-endian or big-endian format.
Distinguishing legitimate WMI traffic from malicious activity was the next hurdle. KPN engaged system administrators responsible for critical assets, particularly domain controllers. These administrators often had internal policies regarding WMI usage, such as specific source machines approved for remote administration. This information formed a policy-based blueprint for rule refinement, allowing the creation of rules that would alert on WMI activity originating from unauthorized sources. However, Blokker cautioned that this "one-off" exercise could lead to false positives if the operational environment changed (e.g., new administrative machines added or decommissioned) without updating the detection policy.
The refined rules were then put to the test against KPN's red team. This crucial step revealed a significant blind spot: while WMI activity from Windows clients (like PowerShell) triggered the rules, activity from Linux clients using the open-source Impacket library did not. This forced a re-evaluation of the detection strategy. Instead of focusing on client-side behavior, Blokker realized the authoritative source for how a server should behave lies in its specifications.
Consulting the Microsoft Developer Network (MDN) documentation on the WMI protocol proved pivotal. The specification clearly states that a client must call the IWbemLevel1Login::NTLMLogin method, which is uniquely identified by a specific UUID (the _IWbemLevel1Login interface) and uses opnum 6. Analysis of Impacket's source code confirmed that it, too, adhered to these specified interfaces and methods. This led to the development of a "golden rule" based on the IWbemLevel1Login interface and opnum 6, forming the core of the WMI stage detection rules. The ruleset was further categorized into RPC stage (gray) for initial RPC handshakes and WMI stage (yellow for the golden rule) for specific WMI method calls.
Detecting brute-force or failed WMI access attempts was another important objective. By intentionally using invalid credentials, packet captures showed that the server responds with a denied response, encapsulated within a fault packet. Consulting documentation on RPC fault packet anatomy, Blokker identified that the error code 5 (representing "access denied") is located at byte position 24 with a length of 4 bytes. This allowed for the creation of a rule like content:"|05 00 00 00|"; offset:24; depth:4;. Initial testing showed this rule needed iterative tweaking, and Blokker recommended using it in combination with a threshold to minimize false positives, as some legitimate client-server negotiations might involve protocol-specific denials.
A critical aspect of WMI security, and a potential evasion vector, is authentication levels. WMI, leveraging DCOM, supports various authentication levels, from None to Packet Privacy. The default is Connect, which authenticates client and server credentials but does not encrypt data. Packet Privacy, however, is the only level that encrypts the entire data stream. KPN investigated whether an attacker could force a higher authentication level to evade network detection. Using the Windows DCOM configuration tool (dcomcnfg), which exposes registry settings for DCOM, they set up a lab environment to force higher authentication levels at machine-wide, process-wide, or service-wide scopes.
Lab testing revealed that under default Connect authentication, the "golden rule" triggered reliably across most use cases. However, when Packet Privacy (full encryption) was enforced on both the client and server, the "golden rule" did not trigger for Windows clients, while it surprisingly did for Linux clients. This discrepancy highlighted that encryption fundamentally alters the network signature, necessitating new rules derived from encrypted packet captures. While forcing Packet Privacy might be less common in enterprise environments due to operational overhead, it represents a significant evasion technique that defenders must account for, demonstrating the need for adaptable detection strategies.
Demo / Proof of Concept
▶ Watch: Proactively assessing false negatives via WMI authentication levels (29:00)
While the talk did not feature a live, interactive demonstration of an attack or a specific tool in real-time, Jaco Blokker effectively demonstrated the methodology and outcomes of KPN's research through detailed explanations of their testing process and results.
The "demo" essentially comprised:
- Illustrating initial packet captures: Showing the RPC End-mapper connection on port 135 and the Object Exporter ID Resolver UUID (
[08:00]). - Visualizing rule logic: Presenting simplified Snort-like rule patterns incorporating RPC interface, opnum, and stub data (
[12:00]). - Demonstrating policy integration: Explaining how legitimate WMI sources defined by administrators were incorporated into detection rules (
[14:00]). - Showcasing red team testing: Describing how different clients (Windows PowerShell, Linux Impacket) were used and the resulting detection gaps (
[16:00]). - Presenting the "golden rule": Explaining its derivation from MDN specifications and its effectiveness (
[18:00]). - Detailing failed attempt detection: Breaking down the anatomy of an RPC fault packet and the specific error code for access denied (
[20:00]). - Displaying test results as heatmaps: Using a binary heatmap (y-axis: rule categories, x-axis: use cases) to visually represent rule triggers. This was used to show the effectiveness of the golden rule and the initial failure and subsequent improvement of the reject rule (
[22:00],[24:00],[25:00]). - Exploring evasion through authentication levels: Showing how different DCOM authentication levels (default, client-forced encryption, client-server forced encryption) impacted rule triggers, necessitating new rules (
[34:00],[36:00],[37:00]).
Through these detailed explanations and visual aids, Blokker provided a comprehensive "proof of concept" for KPN's WMI detection strategy and the iterative development process required to achieve it.
Defensive Implications
▶ Watch: Q&A: Distinguishing legit traffic and inspecting WMI commands (41:00)
The research presented by Jaco Blokker offers several critical defensive implications for organizations aiming to detect and prevent WMI-based lateral movement:
- Implement Network-Level WMI Detection: Organizations should prioritize deploying network-based detection capabilities for WMI traffic, especially on critical assets like domain controllers. KPN's open-sourced Snort ruleset provides a valuable starting point for this. Relying solely on endpoint detection is insufficient, as network visibility offers an independent layer of defense.
- Understand WMI Protocol Details: Defenders must move beyond generic signatures and gain a deep understanding of the WMI protocol, including its RPC/DCOM transport, interface UUIDs, operational numbers, and packet structures. Consulting authoritative sources like the Microsoft Developer Network (MDN) documentation is crucial for developing robust and accurate detections.
- Leverage the "Golden Rule": The
IWbemLevel1Login::NTLMLoginmethod (opnum 6) serves as a reliable indicator of WMI authentication attempts. Monitoring for this specific RPC call can act as a foundational "golden rule" for WMI detection, particularly for initial access and credential validation stages. - Establish Policy-Based Whitelisting: Collaborate with system administrators to define and enforce clear policies for legitimate WMI administration. Whitelist expected source IP addresses or subnets that are authorized to perform WMI operations on critical servers. Regularly review and update these policies to prevent false positives from legitimate administrative changes.
- Detect Failed WMI Attempts: Implement detection for failed WMI authentication or authorization attempts by looking for RPC fault packets containing error code 5 (access denied) at the specified offset (byte 24, length 4). Combine this with thresholding to prevent alert fatigue from transient network issues or benign denials, while still catching brute-force attempts.
- Account for WMI Authentication Levels: Be aware that WMI authentication levels, particularly the use of Packet Privacy (encryption), can significantly alter network signatures and potentially bypass detection rules designed for unencrypted traffic. Defenders should test their rules against various authentication levels and develop additional signatures if encrypted WMI traffic is a concern in their environment or a potential evasion vector.
- Proactive False Negative Assessment: Continuously test detection rules against known and emerging WMI evasion techniques. Engage red teams or conduct internal purple team exercises with diverse WMI client tools (e.g., PowerShell,
wmic, Impacket on Linux) and varying authentication levels. This proactive approach helps identify and close detection gaps before a real incident occurs. - Foster Cross-Team Collaboration: Effective WMI detection is a shared responsibility. Security analysts must collaborate closely with system administrators to understand legitimate WMI usage patterns and obtain necessary context. Engagement with red teams is vital for realistic testing and uncovering blind spots. This collaboration also raises awareness among operational teams about the security implications of WMI.
- Combine Network with Endpoint Detection: While this talk focused on network detection, a comprehensive defense strategy should ideally combine network-level WMI monitoring with endpoint logging and telemetry (e.g., Event ID 5857, 5858, 5861, 4624/4625 for authentication, WMI activity logs) to provide a holistic view of WMI activity.
Key Takeaways
- Network-level WMI detection is challenging but feasible and crucial for enterprise security. Existing solutions often overlook network traffic, creating blind spots for lateral movement techniques heavily leveraged by threat actors.
- Deep protocol understanding is vital for robust detection. Relying on high-level patterns is insufficient; analyzing RPC/DCOM structures, interface UUIDs, and operational numbers, often informed by official specifications (like MDN), is key to accurate and contextual rule development.
- Cross-functional collaboration is essential for effective security. Engaging with system administrators helps define legitimate baseline behavior, while red team testing uncovers critical detection gaps and validates rule efficacy in realistic scenarios.
- WMI authentication levels, particularly encryption, can significantly impact network detection. Defenders must be aware of how different DCOM authentication levels alter network traffic and adapt their rules to cover potential evasion techniques, such as forced
Packet Privacy. - Proactive assessment of false negatives is paramount. Relying solely on successful detections is insufficient; continuous testing against various client tools, authentication methods, and potential evasion techniques is necessary to ensure comprehensive coverage against evolving threats.
- Open-sourcing detection rules fosters community improvement. Sharing developed rulesets, like KPN's Snort rules for WMI, allows for collective enhancement, broader adoption, and stronger defenses across the security community.
About the Speaker(s)
Jaco Blokker is a Security Analyst at KPN, a role he has held for over six years. His responsibilities include safeguarding KPN and its customers through diligent security analysis. This involves a considerable amount of time dedicated to sifting through logs, analyzing security events, and developing and tuning detection mechanisms, such as those used on KPN's Snort-based platform. His work highlights a practical, hands-on approach to identifying and addressing critical security challenges within a large enterprise environment.