CVE-2019-0708 BlueKeep Microsoft Remote Desktop RCE Check - Metasploit
This page contains detailed information about how to use the auxiliary/scanner/rdp/cve_2019_0708_bluekeep metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: CVE-2019-0708 BlueKeep Microsoft Remote Desktop RCE Check
Module: auxiliary/scanner/rdp/cve_2019_0708_bluekeep
Source code: modules/auxiliary/scanner/rdp/cve_2019_0708_bluekeep.rb
Disclosure date: 2019-05-14
Last modification time: 2022-01-23 15:28:32 +0000
Supported architecture(s): -
Supported platform(s): -
Target service / protocol: -
Target network port(s): 3389
List of CVEs: CVE-2019-0708
This module is also known as BlueKeep.
This module checks a range of hosts for the CVE-2019-0708 vulnerability by binding the MS_T120 channel outside of its normal slot and sending non-DoS packets which respond differently on patched and vulnerable hosts. It can optionally trigger the DoS vulnerability.
Module Ranking and Traits
Module Ranking:
- normal: The exploit is otherwise reliable, but depends on a specific version and can't (or doesn't) reliably autodetect. More information about ranking can be found here.
Stability:
- crash-safe: Module should not crash the service.
Basic Usage
This module is a scanner module, and is capable of testing against multiple hosts.
msf > use auxiliary/scanner/rdp/cve_2019_0708_bluekeep
msf auxiliary(cve_2019_0708_bluekeep) > show options
... show and set options ...
msf auxiliary(cve_2019_0708_bluekeep) > set RHOSTS ip-range
msf auxiliary(cve_2019_0708_bluekeep) > exploit
Other examples of setting the RHOSTS option:
Example 1:
msf auxiliary(cve_2019_0708_bluekeep) > set RHOSTS 192.168.1.3-192.168.1.200
Example 2:
msf auxiliary(cve_2019_0708_bluekeep) > set RHOSTS 192.168.1.1/24
Example 3:
msf auxiliary(cve_2019_0708_bluekeep) > set RHOSTS file:/tmp/ip_list.txt
Required Options
- RHOSTS: The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
Knowledge Base
CVE-2019-0708 ("BlueKeep") may allow an unauthenticated attacker to gain remote code execution on an unpatched Microsoft Windows workstation or server exposing the Remote Desktop Protocol (RDP). As a result, the vulnerability has the maximum CVSS score of 10.0.
The vulnerability exists and been patched in workstation editions of Windows XP, Windows Vista, and Windows 7. Server releases of Windows are also affected and have been patched: Windows 2003, Windows 2008 and Windows 2008 R2.
This module, auxiliary/scanner/rdp/cve_2019_0708_bluekeep
, scans all versions of Windows, reporting back the vulnerable state of one or more targets. The vulnerability is not known to exist in versions of Windows 8 (or above) or Windows 2012 (or above). However, the scanner can safely be used against all Windows versions without effect on the RDP service or clients.
Vulnerable Application
Remote Desktop Protocol (RDP), also known as Terminal Services, allows authenticated users to remotely administer Windows workstations and servers. RDP is common in enterprise networks, as it allows IT administrators and users alike to conveniently work remotely. Additionally, RDP is not uncommon to see exposed to the Internet, sometimes on its default port of TCP/3389.
RDP is supported on Windows platforms from Windows XP through all modern versions of Windows. Newer versions of Windows (XP SP3+, Vista, and up) support Network Level Authentication (NLA), which provides enhanced authentication and mitigates some RDP-based attacks.
Verification Steps
- Set up a Windows target (XP, Vista, 7, 2003, 2008, 2008 R2).
- Start msfconsole.
- Load the module:
use auxiliary/scanner/rdp/cve_2019_0708_bluekeep
- Specify the IP address of one or more targets:
set RHOSTS 192.168.1.1-5
- Optionally, change the target port from the default of
3389
:set RPORT 31337
- Launch the scanner:
run
Scenarios
A vulnerable version and configuration of Microsoft Windows
If the target has RDP accessible with NLP disabled, and is running a vulnerable version of Windows (XP, 7, 2003, 2008, 2008 R2) without a patch, it will return a Vulnerable status:
[+] 192.168.1.2:3389 - The target is vulnerable.
[*] 192.168.1.2:3389 - Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
A patched or NLP-enabled configuration of Microsoft Windows
If the target has RDP accessible, but is not vulnerable for one or more reasons, it may have NLP enabled or may have been patched. In these cases, a patched or NLP-enabled target will return:
[*] 192.168.1.3:3389 - The target is not exploitable.
[*] 192.168.1.3:3389 - Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
A non-vulnerable version of Microsoft Windows
If the target has RDP accessible, but is a newer, non-vulnerable version of Windows (8, 10, 2012, 2016), or may have been patched. In these cases, a non-vulnerable target will return:
[*] 192.168.1.4:3389 - The target is not exploitable.
[*] 192.168.1.4:3389 - Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
A host without RDP enabled
A non-Windows target, or a Windows target with RDP disabled or firewalled, will report failure to connect:
[*] 192.168.220.1:3389 - The target service is not running, or refused our connection.
[*] 192.168.220.1:3389 - Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
Testing
This scanner module has been tested against a variety of Windows hosts, ranging from Windows XP through Windows 2016. During testing, no adverse effects or logging was identified on release builds. (Note: Debug/checked builds exhibited crashes, but these should not be found in production environments.)
Workstation versions: - Windows XP SP2 (x86), SP3 (x86), Version 2003 (x64) - Windows Vista SP0 (x86), SP0 (x64), SP2 (x64) - Windows 7 SP1 (x86), SP1 (x64) - Windows 10 1709, 1809 (x64)
Server versions: - Windows 2000 SP4 (x86) - Windows 2003 SP0 (x86), SP1 (x86), SP1 (x64), SP2 (x86), R2 SP1 (x86), R2 SP2 (x86) - Windows 2008 SP0 (x64), SP1 (x86), R2 SP1 (x64) - Windows 2012 R2 (x64) - Windows 2016 Build 1607 (x64)
Questions? Issues?
If you encounter issues with the module, consider reaching out to the developers and user community using Slack. If you encounter crashing on any targets, please consider opening a issue.
Go back to menu.
Msfconsole Usage
Here is how the scanner/rdp/cve_2019_0708_bluekeep auxiliary module looks in the msfconsole:
msf6 > use auxiliary/scanner/rdp/cve_2019_0708_bluekeep
msf6 auxiliary(scanner/rdp/cve_2019_0708_bluekeep) > show info
Name: CVE-2019-0708 BlueKeep Microsoft Remote Desktop RCE Check
Module: auxiliary/scanner/rdp/cve_2019_0708_bluekeep
License: Metasploit Framework License (BSD)
Rank: Normal
Disclosed: 2019-05-14
Provided by:
National Cyber Security Centre
JaGoTu
zerosum0x0
Tom Sellers
Module stability:
crash-safe
Available actions:
Name Description
---- -----------
Crash Trigger denial of service vulnerability
Scan Scan for exploitable targets
Check supported:
Yes
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
RDP_CLIENT_IP 192.168.0.100 yes The client IPv4 address to report during connect
RDP_CLIENT_NAME rdesktop no The client computer name to report during connect, UNSET = random
RDP_DOMAIN no The client domain name to report during connect
RDP_USER no The username to report during connect, UNSET = random
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 3389 yes The target port (TCP)
THREADS 1 yes The number of concurrent threads (max one per host)
Description:
This module checks a range of hosts for the CVE-2019-0708
vulnerability by binding the MS_T120 channel outside of its normal
slot and sending non-DoS packets which respond differently on
patched and vulnerable hosts. It can optionally trigger the DoS
vulnerability.
References:
https://nvd.nist.gov/vuln/detail/CVE-2019-0708
https://portal.msrc.microsoft.com/en-US/security-guidance/advisory/CVE-2019-0708
https://zerosum0x0.blogspot.com/2019/05/avoiding-dos-how-bluekeep-scanners-work.html
Also known as:
BlueKeep
Module Options
This is a complete list of options available in the scanner/rdp/cve_2019_0708_bluekeep auxiliary module:
msf6 auxiliary(scanner/rdp/cve_2019_0708_bluekeep) > show options
Module options (auxiliary/scanner/rdp/cve_2019_0708_bluekeep):
Name Current Setting Required Description
---- --------------- -------- -----------
RDP_CLIENT_IP 192.168.0.100 yes The client IPv4 address to report during connect
RDP_CLIENT_NAME rdesktop no The client computer name to report during connect, UNSET = random
RDP_DOMAIN no The client domain name to report during connect
RDP_USER no The username to report during connect, UNSET = random
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 3389 yes The target port (TCP)
THREADS 1 yes The number of concurrent threads (max one per host)
Auxiliary action:
Name Description
---- -----------
Scan Scan for exploitable targets
Advanced Options
Here is a complete list of advanced options supported by the scanner/rdp/cve_2019_0708_bluekeep auxiliary module:
msf6 auxiliary(scanner/rdp/cve_2019_0708_bluekeep) > show advanced
Module advanced options (auxiliary/scanner/rdp/cve_2019_0708_bluekeep):
Name Current Setting Required Description
---- --------------- -------- -----------
CHOST no The local client address
CPORT no The local client port
ConnectTimeout 10 yes Maximum number of seconds to establish a TCP connection
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
RDP_TLS_SECURITY_LEVEL 0 yes Change default TLS security level. "0" (default) means everything is permitted. "1" rejects very weak parameters and "2" is even stricter.
SSL false no Negotiate SSL/TLS for outgoing connections
SSLCipher no String for SSL cipher - "DHE-RSA-AES256-SHA" or "ADH"
SSLVerifyMode PEER no SSL verification method (Accepted: CLIENT_ONCE, FAIL_IF_NO_PEER_CERT, NONE, PEER)
SSLVersion Auto yes Specify the version of SSL/TLS to be used (Auto, TLS and SSL23 are auto-negotiate) (Accepted: Auto, TLS, SSL23, SSL3, TLS1, TLS1.1, TLS1.2)
ShowProgress true yes Display progress messages during a scan
ShowProgressPercent 10 yes The interval in percent that progress should be shown
VERBOSE false no Enable detailed status messages
WORKSPACE no Specify the workspace for this module
Auxiliary Actions
This is a list of all auxiliary actions that the scanner/rdp/cve_2019_0708_bluekeep module can do:
msf6 auxiliary(scanner/rdp/cve_2019_0708_bluekeep) > show actions
Auxiliary actions:
Name Description
---- -----------
Crash Trigger denial of service vulnerability
Scan Scan for exploitable targets
Evasion Options
Here is the full list of possible evasion options supported by the scanner/rdp/cve_2019_0708_bluekeep auxiliary module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 auxiliary(scanner/rdp/cve_2019_0708_bluekeep) > show evasion
Module evasion options:
Name Current Setting Required Description
---- --------------- -------- -----------
TCP::max_send_size 0 no Maxiumum tcp segment size. (0 = disable)
TCP::send_delay 0 no Delays inserted before every send. (0 = disable)
Go back to menu.
Error Messages
This module may fail with the following error messages:
- The target service is not running or refused our connection.
- Unexpected error: <E.MESSAGE>
- Error communicating RDP protocol.
- Connection reset
- Unexpected error: <E.MESSAGE>
- Target doesn't appear to have been crashed. Consider retrying.
- The target appears to have been crashed by disconnecting from an incorrectly-bound MS_T120 channel.
- The target attempted cleanup of the incorrectly-bound MS_T120 channel.
- The target attempted cleanup of the incorrectly-bound MS_T120 channel.
- Could not connect to RDP service.
Check for the possible causes from the code snippets below found in the module source code. This can often times help in identifying the root cause of the problem.
The target service is not running or refused our connection.
Here is a relevant code snippet related to the "The target service is not running or refused our connection." error message:
90:
91: begin
92: begin
93: rdp_connect
94: rescue ::Errno::ETIMEDOUT, Rex::HostUnreachable, Rex::ConnectionTimeout, Rex::ConnectionRefused, ::Timeout::Error, ::EOFError
95: return Exploit::CheckCode::Safe('The target service is not running or refused our connection.')
96: end
97:
98: status = check_rdp_vuln
99: rescue Rex::AddressInUse, ::Errno::ETIMEDOUT, Rex::HostUnreachable, Rex::ConnectionTimeout, Rex::ConnectionRefused, ::Timeout::Error, ::EOFError, ::TypeError => e
100: bt = e.backtrace.join("\n")
Unexpected error: <E.MESSAGE>
Here is a relevant code snippet related to the "Unexpected error: <E.MESSAGE>" error message:
96: end
97:
98: status = check_rdp_vuln
99: rescue Rex::AddressInUse, ::Errno::ETIMEDOUT, Rex::HostUnreachable, Rex::ConnectionTimeout, Rex::ConnectionRefused, ::Timeout::Error, ::EOFError, ::TypeError => e
100: bt = e.backtrace.join("\n")
101: vprint_error("Unexpected error: #{e.message}")
102: vprint_line(bt)
103: elog(e)
104: rescue RdpCommunicationError
105: vprint_error('Error communicating RDP protocol.')
106: status = Exploit::CheckCode::Unknown
Error communicating RDP protocol.
Here is a relevant code snippet related to the "Error communicating RDP protocol." error message:
100: bt = e.backtrace.join("\n")
101: vprint_error("Unexpected error: #{e.message}")
102: vprint_line(bt)
103: elog(e)
104: rescue RdpCommunicationError
105: vprint_error('Error communicating RDP protocol.')
106: status = Exploit::CheckCode::Unknown
107: rescue Errno::ECONNRESET
108: vprint_error('Connection reset')
109: rescue StandardError => e
110: bt = e.backtrace.join("\n")
Connection reset
Here is a relevant code snippet related to the "Connection reset" error message:
103: elog(e)
104: rescue RdpCommunicationError
105: vprint_error('Error communicating RDP protocol.')
106: status = Exploit::CheckCode::Unknown
107: rescue Errno::ECONNRESET
108: vprint_error('Connection reset')
109: rescue StandardError => e
110: bt = e.backtrace.join("\n")
111: vprint_error("Unexpected error: #{e.message}")
112: vprint_line(bt)
113: elog(e)
Unexpected error: <E.MESSAGE>
Here is a relevant code snippet related to the "Unexpected error: <E.MESSAGE>" error message:
106: status = Exploit::CheckCode::Unknown
107: rescue Errno::ECONNRESET
108: vprint_error('Connection reset')
109: rescue StandardError => e
110: bt = e.backtrace.join("\n")
111: vprint_error("Unexpected error: #{e.message}")
112: vprint_line(bt)
113: elog(e)
114: ensure
115: rdp_disconnect
116: end
Target doesn't appear to have been crashed. Consider retrying.
Here is a relevant code snippet related to the "Target doesn't appear to have been crashed. Consider retrying." error message:
165: sleep(1)
166: rdp_disconnect
167:
168: sleep(5)
169: if rdp_reachable
170: print_error("Target doesn't appear to have been crashed. Consider retrying.")
171: return Exploit::CheckCode::Unknown
172: else
173: print_good('Target service appears to have been successfully crashed.')
174: return Exploit::CheckCode::Vulnerable('The target appears to have been crashed by disconnecting from an incorrectly-bound MS_T120 channel.')
175: end
The target appears to have been crashed by disconnecting from an incorrectly-bound MS_T120 channel.
Here is a relevant code snippet related to the "The target appears to have been crashed by disconnecting from an incorrectly-bound MS_T120 channel." error message:
169: if rdp_reachable
170: print_error("Target doesn't appear to have been crashed. Consider retrying.")
171: return Exploit::CheckCode::Unknown
172: else
173: print_good('Target service appears to have been successfully crashed.')
174: return Exploit::CheckCode::Vulnerable('The target appears to have been crashed by disconnecting from an incorrectly-bound MS_T120 channel.')
175: end
176: end
177:
178: # Quick check for the Ultimatum PDU
179: begin
The target attempted cleanup of the incorrectly-bound MS_T120 channel.
Here is a relevant code snippet related to the "The target attempted cleanup of the incorrectly-bound MS_T120 channel." error message:
179: begin
180: res = rdp_recv(-1, 1)
181: rescue EOFError
182: # we don't care
183: end
184: return Exploit::CheckCode::Vulnerable('The target attempted cleanup of the incorrectly-bound MS_T120 channel.') if res&.include?(['0300000902f0802180'].pack('H*'))
185:
186: # Slow check for Ultimatum PDU. If it doesn't respond in a timely
187: # manner then the host is likely patched.
188: begin
189: 4.times do
The target attempted cleanup of the incorrectly-bound MS_T120 channel.
Here is a relevant code snippet related to the "The target attempted cleanup of the incorrectly-bound MS_T120 channel." error message:
188: begin
189: 4.times do
190: res = rdp_recv
191: # 0x2180 = MCS Disconnect Provider Ultimatum PDU - 2.2.2.3
192: if res.include?(['0300000902f0802180'].pack('H*'))
193: return Exploit::CheckCode::Vulnerable('The target attempted cleanup of the incorrectly-bound MS_T120 channel.')
194: end
195: end
196: rescue RdpCommunicationError
197: # we don't care
198: end
Could not connect to RDP service.
Here is a relevant code snippet related to the "Could not connect to RDP service." error message:
203:
204: def check_rdp_vuln
205: # check if rdp is open
206: is_rdp, version_info = rdp_fingerprint
207: unless is_rdp
208: vprint_error('Could not connect to RDP service.')
209: return Exploit::CheckCode::Unknown
210: end
211: rdp_disconnect
212: rdp_connect
213: is_rdp, server_selected_proto = rdp_check_protocol
Go back to menu.
Related Pull Requests
- #13608 Merged Pull Request: Standardise Error Logging
- #12990 Merged Pull Request: Add rubocop rules to consistently format modules
- #12428 Merged Pull Request: Extend check codes with custom messages
- #12353 Merged Pull Request: Make BlueKeep scanner's output less chatty
- #12283 Merged Pull Request: Add initial exploit for CVE-2019-0708, BlueKeep
- #12170 Merged Pull Request: Add DoS action to BlueKeep (CVE-2019-0708) scanner
- #12171 Merged Pull Request: Add Msf::Exploit::Remote::RDP mixin and refactor BlueKeep (CVE-2019-0708) scanner
- #12152 Merged Pull Request: Rescue EOFError in cve_2019_0708_bluekeep get_once
- #11993 Merged Pull Request: Explicitly require 'rc4' in the BlueKeep scanner.
- #11932 Merged Pull Request: Bluekeep (CVE-2019-0708): add TLS, document blobs, refactor
References
- CVE-2019-0708
- https://portal.msrc.microsoft.com/en-US/security-guidance/advisory/CVE-2019-0708
- https://zerosum0x0.blogspot.com/2019/05/avoiding-dos-how-bluekeep-scanners-work.html
See Also
Check also the following modules related to this module:
- exploit/windows/rdp/cve_2019_0708_bluekeep_rce
- auxiliary/scanner/rdp/ms12_020_check
- auxiliary/scanner/rdp/rdp_scanner
- auxiliary/admin/dcerpc/cve_2020_1472_zerologon
- auxiliary/admin/dcerpc/cve_2021_1675_printnightmare
- auxiliary/admin/sap/cve_2020_6207_solman_rce
- auxiliary/admin/sap/cve_2020_6287_ws_add_user
- auxiliary/gather/cve_2021_27850_apache_tapestry_hmac_key
- auxiliary/admin/http/hikvision_unauth_pwd_reset_cve_2017_7921
- auxiliary/dos/windows/http/http_sys_accept_encoding_dos_cve_2021_31166
- auxiliary/gather/hikvision_info_disclosure_cve_2017_7921
- auxiliary/dos/windows/rdp/ms12_020_maxchannelids
- exploit/windows/rdp/rdp_doublepulsar_rce
- auxiliary/dos/http/wordpress_directory_traversal_dos
- auxiliary/dos/http/wordpress_long_password_dos
- auxiliary/dos/http/wordpress_xmlrpc_dos
- auxiliary/scanner/http/rdp_web_login
- auxiliary/scanner/http/wordpress_content_injection
- auxiliary/scanner/http/wordpress_cp_calendar_sqli
- auxiliary/scanner/http/wordpress_ghost_scanner
- auxiliary/scanner/http/wordpress_login_enum
- auxiliary/scanner/http/wordpress_multicall_creds
- auxiliary/scanner/http/wordpress_pingback_access
- auxiliary/scanner/http/wordpress_scanner
- auxiliary/scanner/http/wordpress_xmlrpc_login
- exploit/windows/fileformat/cain_abel_4918_rdp
- post/windows/manage/enable_rdp
- exploit/linux/http/cve_2019_1663_cisco_rmi_rce
- exploit/multi/http/cisco_dcnm_upload_2019
- exploit/windows/local/cve_2019_1458_wizardopium
Related Nessus plugins:
- KB4499180: Windows Server 2008 and Windows Vista SP2 May 2019 Security Update (BlueKeep)
- KB4499175: Windows 7 and Windows Server 2008 R2 May 2019 Security Update (MDSUM/RIDL) (MFBDS/RIDL/ZombieLoad) (MLPDS/RIDL) (MSBDS/Fallout) (BlueKeep)
- Microsoft Security Advisory 4500331: Guidance for older platforms (XP / 2003) (BlueKeep)
- Microsoft RDP RCE (CVE-2019-0708) (BlueKeep) (uncredentialed check)
Authors
- National Cyber Security Centre
- JaGoTu
- zerosum0x0
- Tom Sellers
Version
This page has been produced using Metasploit Framework version 6.2.26-dev. For more modules, visit the Metasploit Module Library.
Go back to menu.