Ga naar content

Protect yourself against CVE-2019-0708 aka BlueKeep using Azure Sentinel and Microsoft Defender ATP

On May 14th 2019, Microsoft’s Security Response Center issued guidance that a vulnerability was found in Remote Desktop Services, formerly known as Terminal Services, allowing an unauthenticated hacker to execute code on the target system. Windows 7, Windows Server 2008 and 2008 R2 are affected.

Microsoft issued a fix and advised to patch directly because the vulnerability is ‘wormable’ and to prevent a situation such as with WannaCry and others. Underlining the importance of the CVE is the fact that Microsoft backported the fix to Windows XP and Windows Server 2003.  The vulnerability was nicknamed BlueKeep in the infosec community.

In this article we’ll show you how Azure Sentinel and Microsoft Defender ATP can help you get more background information on the CVE, show you which systems are affected, and how to detect when the CVE is exploited.

Patch Management is still a #1 priority

A good patch management strategy is commonly listed as one of the basics of an organizational cybersecurity strategy. Unfortunately, we still see companies not regularly patching their systems. This has a number of reasons: a lack of technical staff can make updating a little scary, undermanned IT staff can become busy with problems perceived to be ‘more important’, and an often heard answer is that some updates can cause performance issues or ‘break stuff’. Regardless of the reasons why an organization may procrastinate when it comes to patching, it’s a critical process that needs to be in place.

The good news is that Microsoft Azure provides Update Management as a service. It’s technically part of Azure Security Center and uses the Microsoft Management Agent on your servers (which will likely already be there for monitoring, security management and other tasks) to report status and execute the fixes. If you’re in a hybrid world and want to cover your on-premises servers, Microsoft’s System Center Configuration Manager (SCCM) together with Microsoft Intune is a great option as well.

Microsoft Defender ATP knows more about the CVE

When a CVE is reported, one of the first things you’ll likely be doing is searching for more background information on this exploit. A good starting point could be the article that MSRC issued, or the corresponding document on MITRE’s website.

But if you’re using Microsoft Defender ATP, there is a section called Threat Analytics where the MDATP team regularly posts important information. On the day MSRC issued the guidance, the MDATP team put up an article about the CVE called “Wormable RCE vulnerability in RDP”. It has key insights, tasks that can be used for mitigation, links to the fixes, and much more. The best part though are the integrated dashboards: the page shows you which machines in your environment are exploitable.

The MDATP team also provides a KQL query that can identify machines with relatively intense outbound network activity on the common RDP port (TCP/3389) which you can use to find processes that might be scanning for possible targets or exhibiting worm-like behavior.

How does the exploit work?

If you’d get into the nitty gritty details of how the RDP protocol works and why it is that on Windows 7, Windows Server 2008 and 2008 R2 it can be exploited, check out this write-up from Matt and Aaron. TL;DR: it’s not the protocol but the implementation on those OS’s.

A quick query at Shodan reveals that there are at least 2+ Million machines connected to the internet that publicly expose RDP at the default port of 3389. Most of them in the US and China, and about 130K of them are hosted on Amazon AWS. Rob Graham argues that around 950K of them are vulnerable for BlueKeep. Bad Packets report the number of RDP scans per country.

GreyNoise is actively monitoring and at the time of this writing observing sweeping tests for systems vulnerable to BlueKeep from several dozen hosts around the Internet. Interesting fact: that activity has been observed from exclusively TOR exit nodes and is likely being executed by a single actor.

Besides disabling RDP and port 3389 when it’s not needed, another important workaround would be to enable Network Level Authentication (NLA) on systems running Windows 7, Windows Server 2008 and 2008 R2. With NLA turned on, an attacker would first need to authenticate to Remote Desktop Services using a valid account on the target system before the attacker could exploit the vulnerability.

To identify assets at risk, refer to the following table by Dragos:

PRO TIP: Are you red teaming and want to get more information of the OS/system you are connecting to? If you get prompted for a login for RDP before login screen, enter .\guest no password and it bumps you to login screen. Thanks Kevin!

Azure Cloud Shell & PowerShell can help

Now, if you’re running your Windows VM’s in Azure, you might want to have a look at your Network Security Groups (NSG’s). This is the time where you will want to evaluate if having that port 3389 opened up to the internet is a good idea. (Answer: nope).

Here’s a PowerShell script to check all of your Azure Subscriptions, and for each resource group query all the NSG’s to see if 3389 is open:

PRO TIP: You can use Azure Cloud Shell to run this script!

PRO TIP: Another option to look at is the just released ‘Adaptive Network Hardening’ feature of Azure Security Center. It learns the network traffic and connectivity patterns of your Azure workloads and provides you with NSG rule recommendations for your internet-facing virtual machines.

InfoSec community at work

The bigger danger at this stage is the exploitation of CVE-2019–0708 once inside the organization to quickly compromise hosts and for Lateral Movement. And since the first real exploit proof of concept is publicly out there reported by Chase Dardaman, we will leverage Azure Sentinel to build detection for BlueKeep.

So how do you start detecting potential BlueKeep related behavior? Markus Neis at Swisscom shared a Sigma rule to the GitHub repo for addressing Lateral Movement technique T1210 (exploitation of Remote Services) within 24 hours of the CVE becoming public knowledge. The same day, SOC Prime’s Roman Ranskyi also published a Sigma rule with detection logic extending to Masquerading technique T1036 and Network Service Scanning technique T1046.

Recently, Adam also shared his findings that account name AAAAAAA in a 4625 Windows Event is a potential indicator of people downloading this BlueKeep scanner from GitHub and running it without modification against an RDP server. Florian Roth then turned this into a Sigma rule.

How to detect BlueKeep exploit usage in Azure Sentinel

Azure Sentinel keep help detect BlueKeep. By sourcing information from the intelligent security graph, Azure Security Center, and many other sources, Microsoft’s coud SIEM can provide detection. Using the combined knowledge of the InfoSec community, it is easy to add the appropriate Alert Rules.

Here’s the KQL query to detect suspicious outbound RDP connections. It detects non-standard tools connecting to TCP port 3389 indicating possible lateral movement:

PRO TIP: You will need to have SwiftOnSecurity’s Sysmon configuration installed on the RDP / TS machines you will be protecting / monitoring.

Here’s the KQL query to detect the use of a scanner by zerosum0x0 that discovers targets vulnerable to BlueKeep:


Considering all the above, the top 3 things you can do as a defender are:

  1. Deploy proactive detection.
  2. Rigorously patch or mitigate the vulnerability.
  3. Keep track on the situation development following input from researchers your trust.


Microsoft security really is more than 1+1. When using a combination of Azure Sentinel, Azure Security Center, Microsoft Defender ATP, and Microsoft Intune, you get an integrated approach to protecting, detecting and responding to threats like BlueKeep.


Happy hunting!

-- Maarten Goet, MVP & RD