Since the Microsoft Remote Desktop Protocol (RDP) vulnerability CVE-2019-0708, commonly knows as BlueKeep, was first announced in May of 2019, the security industry has been holding their breath waiting for the worse case scenario. Scanning for vulnerable RDP instances began almost immediately after the announcement. Since then a number of exploits for BlueKeep have been seen that can crash vulnerable systems, but the anticipated wormable exploit hasn't yet materialized.
Now that both Immunity's Canvas and Rapid7's Metasploit have working exploits in their penetration testing tools you have to believe that it is only a matter of time until the bad guys have one as well.
It would be nice to say that the number of systems running a vulnerable RDP instance has decreased since the vulnerability announcement, but for the IP space I have been tracking I have only seen a decrease of about 10% in vulnerable systems over the last 90 days.
If you are a security administrator and want to find the BlueKeep vulnerable systems on your network, how would you go about it? For the Bluekeep vulnerability it is relatively easy. With access to a *nix box with the high speed scanner masscan and the rdpscan tool installed along with their dependencies, it is a very easy bash script.
I called this bash script scan_bluekeep.sh
#create a date parameter for the various files so scans run on different dates don't overwrite each other.
# put your IPs or IP ranges you would like to scan in scan_ips.txt
# this will be used as the input to masscan
# the output file is rdpips-<DATE>.txt
echo "executing masscan"
/usr/bin/masscan -p3389 -v -iL scan_ips.txt > rdpips-$TDATE.txt
#the output from the masscan will be used as the input to rdpscan
#the output file will be RDP_results-<DATE>.txt
echo "executing rdpscan"
rdpscan --file rdpips-$TDATE.txt > RDP_results-$TDATE.txt
As the comments state, place your IP addresses or ranges to be scanned in the file scan_ips.txt. This will be used as the input file for this script. The output will be two files:
* The masscan output file will be rdpips-<DATE>.txt, all IPs found with RDP open on port 3389 * the rdpscan output file will be RDP_results-<DATE>.txt, the rdpscan result showing each detected RDP instance and whether or not rdpscan believes they are vulnerable to BlueKeep
Checking the rdpscan output in RDP_results-<DATE>.txt you will generally find one of 3 results:
18.104.22.168 - SAFE - Target appears patched
22.214.171.124 - VULNERABLE - got appid
there is also an UNKNOWN result, which is usually one of:
126.96.36.199 - UNKNOWN - RDP protocol error - receive timeout
Concentrate on resolving the VULNERABLE results and you will sleep much better when the wormable exploit finally hits.
-- Rick Wanner MSISE - rwanner at isc dot sans dot edu - http://namedeplume.blogspot.com/ - Twitter:namedeplume (Protected)
Aug 6th 2019
2 weeks ago