How to Detect and Protect Against Bluekeep Attack [Solved]

The objective here is to examine the behavior of the Metasploit BlueKeep Module, which targets the CVE-2019-0708 vulnerability. Our aim is to pinpoint signatures that can be used to create a Snort rule for detecting bluekeep attack.

Both the NCC Group and Talos Intelligence have released Snort rules for identifying the CVE-2019-0708 exploit. However, their detection methods rely on content transmitted under encryption, which is only accessible using specific decryption software or appliances.

In this analysis, the focus will be on the unencrypted portion of the communication.

1. RDP Communication

To begin, it is crucial to understand the fundamentals of RDP communication, as it is the protocol used in this exploit.

Bluekeep Attack

You can access the relevant documentation here.

1.1 Connection Initiation

The client begins the connection process by sending a Class 0 X.224 Connection Request PDU to the server (refer to section 2.2.1.1). In response, the server sends back a Class 0 X.224 Connection Confirm PDU (refer to section 2.2.1.2). From this stage onward, all subsequent data exchanged between the client and server is encapsulated within an X.224 Data Protocol Data Unit (PDU).

1.2 Client MCS Connect Initial PDU

Starting with the “Client MCS Connect Initial PDU with GCC Conference Create Request,” messages are transmitted with some level of encoding.

1.3 Identifying Unencrypted Data

The optimal point to detect unencrypted data from the Metasploit code is during the Connection Request PDU.

1.4 Client X.224 Connection Request PDU

For further details, refer to the Client X.224 Connection Request PDU Documentation.

2. Code Implementation

The connection request PDU is constructed in the lib/msf/core/exploit/rdp.rb file using the following method:

By examining the behavior of the exploit, it is evident that the initial step involves invoking the fingerprint method with the following parameters:

rdp_fingerprint()

This causes the [requested_protocols].pack(‘L<’), of the pdu_negotiation_request(), to results on “0b 00 00 00”.

The options of the RequestedProtocols are:

These values are transmitted in a 32-bit format.

Initially, the value “0b 00 00 00” is sent when the rdp_fingerprint is called for the first time. This occurs due to the application of the “OR” operator on the constants with their default values:

Consequently, the [requested_protocols].pack('L<') generates “0b000000”.

Per the RDP Negotiation Request (RDP_NEG_REQ) documentation, this requested_protocol value activates all three options: [PROTOCOL_SSL, PROTOCOL_HYBRID, PROTOCOL_HYBRID_EX]. The last option triggers the “Early User Authorization Result PDU.”

This occurs only during the initial round, after which the code executes the rdp_fingerprint method again. On the second attempt, it completes successfully.

Following the second “Verifying RDP protocol” step, the “Send data” section displays a payload ending with “01000000,” indicating the standard use of requestedProtocols without employing the “Early User Authorization Result PDU.”

After that, the protocol proceed with the connection and the exploit follow its flow.

The key point is that the initial RDP Negotiation Request PDU sent with the Early User Authorization Result PDU set is not typical behavior. This is neither seen in the Windows RDP Client nor in Linux clients such as Remmina.

Therefore, this specific piece of data in the unencrypted part of the communication serves as the most effective signature for detecting the BlueKeep Metasploit Module.

3. Detect Bluekeep Attack

Based on the above analysis, we can make it very easy to make Snort and Sax2 rules to detect Bluekeep, and below we have listed the rules for two intrusion detection systems.

3.1 Snort Rule

3.2 Sax2 Rule

For more information on how to create a Sax2 detection rule, please refer to the documentation “Detect EternalBlue Exploit via Sax2 IDS

Click to rate this post!
[Total: 0 Average: 0]