Identify endpoints speaking the Remote Desktop Protocol (RDP) - Metasploit


This page contains detailed information about how to use the auxiliary/scanner/rdp/rdp_scanner metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.

Module Overview


Name: Identify endpoints speaking the Remote Desktop Protocol (RDP)
Module: auxiliary/scanner/rdp/rdp_scanner
Source code: modules/auxiliary/scanner/rdp/rdp_scanner.rb
Disclosure date: -
Last modification time: 2021-09-22 15:05:53 +0000
Supported architecture(s): -
Supported platform(s): -
Target service / protocol: -
Target network port(s): 3389
List of CVEs: -

This module attempts to connect to the specified Remote Desktop Protocol port and determines if it speaks RDP. When available, the Credential Security Support Provider (CredSSP) protocol will be used to identify the version of Windows on which the server is running. Enabling the DETECT_NLA option will cause a second connection to be made to the server to identify if Network Level Authentication (NLA) is required.

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.

Side Effects:

  • ioc-in-logs: Module leaves signs of a compromise in a log file (Example: SQL injection data found in HTTP log).

Basic Usage


This module is a scanner module, and is capable of testing against multiple hosts.

msf > use auxiliary/scanner/rdp/rdp_scanner
msf auxiliary(rdp_scanner) > show options
    ... show and set options ...
msf auxiliary(rdp_scanner) > set RHOSTS ip-range
msf auxiliary(rdp_scanner) > exploit

Other examples of setting the RHOSTS option:

Example 1:

msf auxiliary(rdp_scanner) > set RHOSTS 192.168.1.3-192.168.1.200 

Example 2:

msf auxiliary(rdp_scanner) > set RHOSTS 192.168.1.1/24

Example 3:

msf auxiliary(rdp_scanner) > 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


Vulnerable Application


Any system exposing the remote desktop protocol, RDP, typically on 3389/TCP.

Verification Steps


  1. Do: use auxiliary/scanner/rdp/rdp_scanner
  2. Do: set [RHOSTS], replacing [RHOSTS] with a list of hosts to test for the presence of RDP
  3. Do: run
  4. If the host is exposing an identifiable RDP instance, it will print the endpoint.

Options


There are three options currently supported that control what security protocols to send in the RDP negotiation request, which can be helpful in identifying RDP endpoints that might be locked down or configured differently:

TLS Set to true to request TLS security support CredSSP Set to true to request CredSSP support EarlyUser Set to true to request Early User Authorization Result PDU support

Scenarios


msf auxiliary(rdp_scanner) > run

[+] 10.4.18.26:3389       - Identified RDP
[+] 10.4.18.22:3389       - Identified RDP
[+] 10.4.18.89:3389       - Identified RDP
[+] 10.4.18.9:3389        - Identified RDP
[+] 10.4.18.67:3389       - Identified RDP
[+] 10.4.18.80:3389       - Identified RDP
[+] 10.4.18.34:3389       - Identified RDP
[+] 10.4.18.70:3389       - Identified RDP
[+] 10.4.18.30:3389       - Identified RDP
[+] 10.4.18.76:3389       - Identified RDP
[+] 10.4.18.13:3389       - Identified RDP
[+] 10.4.18.91:3389       - Identified RDP
[+] 10.4.18.5:3389        - Identified RDP
[+] 10.4.18.47:3389       - Identified RDP
[+] 10.4.18.41:3389       - Identified RDP
[+] 10.4.18.105:3389      - Identified RDP
[*] Scanned  44 of 256 hosts (17% complete)
[*] Scanned  55 of 256 hosts (21% complete)
[+] 10.4.18.118:3389      - Identified RDP
[+] 10.4.18.108:3389      - Identified RDP
[+] 10.4.18.139:3389      - Identified RDP
[*] Scanned  94 of 256 hosts (36% complete)
[*] Scanned 110 of 256 hosts (42% complete)
[+] 10.4.18.157:3389      - Identified RDP
[+] 10.4.18.166:3389      - Identified RDP
[+] 10.4.18.164:3389      - Identified RDP
[+] 10.4.18.170:3389      - Identified RDP
[+] 10.4.18.185:3389      - Identified RDP
[+] 10.4.18.209:3389      - Identified RDP
[+] 10.4.18.188:3389      - Identified RDP
[*] Scanned 156 of 256 hosts (60% complete)
[+] 10.4.18.237:3389      - Identified RDP
[+] 10.4.18.225:3389      - Identified RDP
[*] Scanned 186 of 256 hosts (72% complete)
[*] Scanned 194 of 256 hosts (75% complete)
[*] Scanned 208 of 256 hosts (81% complete)
[*] Scanned 253 of 256 hosts (98% complete)
[*] Scanned 256 of 256 hosts (100% complete)
[*] Auxiliary module execution completed

Go back to menu.

Msfconsole Usage


Here is how the scanner/rdp/rdp_scanner auxiliary module looks in the msfconsole:

msf6 > use auxiliary/scanner/rdp/rdp_scanner

msf6 auxiliary(scanner/rdp/rdp_scanner) > show info

       Name: Identify endpoints speaking the Remote Desktop Protocol (RDP)
     Module: auxiliary/scanner/rdp/rdp_scanner
    License: Metasploit Framework License (BSD)
       Rank: Normal

Provided by:
  Jon Hart <[email protected]>

Check supported:
  No

Basic options:
  Name             Current Setting  Required  Description
  ----             ---------------  --------  -----------
  DETECT_NLA       true             yes       Detect Network Level Authentication (NLA)
  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 attempts to connect to the specified Remote Desktop 
  Protocol port and determines if it speaks RDP. When available, the 
  Credential Security Support Provider (CredSSP) protocol will be used 
  to identify the version of Windows on which the server is running. 
  Enabling the DETECT_NLA option will cause a second connection to be 
  made to the server to identify if Network Level Authentication (NLA) 
  is required.

References:
  https://msdn.microsoft.com/en-us/library/cc240445.aspx

Module Options


This is a complete list of options available in the scanner/rdp/rdp_scanner auxiliary module:

msf6 auxiliary(scanner/rdp/rdp_scanner) > show options

Module options (auxiliary/scanner/rdp/rdp_scanner):

   Name             Current Setting  Required  Description
   ----             ---------------  --------  -----------
   DETECT_NLA       true             yes       Detect Network Level Authentication (NLA)
   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)

Advanced Options


Here is a complete list of advanced options supported by the scanner/rdp/rdp_scanner auxiliary module:

msf6 auxiliary(scanner/rdp/rdp_scanner) > show advanced

Module advanced options (auxiliary/scanner/rdp/rdp_scanner):

   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/rdp_scanner module can do:

msf6 auxiliary(scanner/rdp/rdp_scanner) > show actions

Auxiliary actions:

   Name  Description
   ----  -----------

Evasion Options


Here is the full list of possible evasion options supported by the scanner/rdp/rdp_scanner auxiliary module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 auxiliary(scanner/rdp/rdp_scanner) > 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:

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.

Error while connecting and negotiating RDP: <E>


Here is a relevant code snippet related to the "Error while connecting and negotiating RDP: <E>" error message:

92:	    is_rdp = false
93:	    begin
94:	      rdp_connect
95:	      is_rdp, service_info = check_rdp
96:	    rescue Rex::ConnectionError => e
97:	      vprint_error("Error while connecting and negotiating RDP: #{e}")
98:	      return
99:	    ensure
100:	      rdp_disconnect
101:	    end
102:	    return unless is_rdp

Go back to menu.


References


See Also


Check also the following modules related to this module:

Authors


Jon Hart <jon_hart[at]rapid7.com>

Version


This page has been produced using Metasploit Framework version 6.1.27-dev. For more modules, visit the Metasploit Module Library.

Go back to menu.