Telnet Service Encryption Key ID Overflow Detection - Metasploit


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

Module Overview


Name: Telnet Service Encryption Key ID Overflow Detection
Module: auxiliary/scanner/telnet/telnet_encrypt_overflow
Source code: modules/auxiliary/scanner/telnet/telnet_encrypt_overflow.rb
Disclosure date: -
Last modification time: 2022-01-23 15:28:32 +0000
Supported architecture(s): -
Supported platform(s): -
Target service / protocol: telnet
Target network port(s): 23
List of CVEs: CVE-2011-4862

Detect telnet services vulnerable to the encrypt option Key ID overflow (BSD-derived telnetd)

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.

Basic Usage


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

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

Other examples of setting the RHOSTS option:

Example 1:

msf auxiliary(telnet_encrypt_overflow) > set RHOSTS 192.168.1.3-192.168.1.200 

Example 2:

msf auxiliary(telnet_encrypt_overflow) > set RHOSTS 192.168.1.1/24

Example 3:

msf auxiliary(telnet_encrypt_overflow) > set RHOSTS file:/tmp/ip_list.txt

Required Options


  • RHOSTS: The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'

Go back to menu.

Msfconsole Usage


Here is how the scanner/telnet/telnet_encrypt_overflow auxiliary module looks in the msfconsole:

msf6 > use auxiliary/scanner/telnet/telnet_encrypt_overflow

msf6 auxiliary(scanner/telnet/telnet_encrypt_overflow) > show info

       Name: Telnet Service Encryption Key ID Overflow Detection
     Module: auxiliary/scanner/telnet/telnet_encrypt_overflow
    License: Metasploit Framework License (BSD)
       Rank: Normal

Provided by:
  Jaime Penalba Estebanez <[email protected]>
  hdm <[email protected]>

Check supported:
  No

Basic options:
  Name      Current Setting  Required  Description
  ----      ---------------  --------  -----------
  PASSWORD                   no        The password for the specified username
  RHOSTS                     yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
  RPORT     23               yes       The target port (TCP)
  THREADS   1                yes       The number of concurrent threads (max one per host)
  TIMEOUT   30               yes       Timeout for the Telnet probe
  USERNAME                   no        The username to authenticate as

Description:
  Detect telnet services vulnerable to the encrypt option Key ID 
  overflow (BSD-derived telnetd)

References:
  http://www.securityfocus.com/bid/51182
  https://nvd.nist.gov/vuln/detail/CVE-2011-4862
  https://www.exploit-db.com/exploits/18280
  https://blog.rapid7.com/2011/12/28/more-fun-with-bsd-derived-telnet-daemons

Module Options


This is a complete list of options available in the scanner/telnet/telnet_encrypt_overflow auxiliary module:

msf6 auxiliary(scanner/telnet/telnet_encrypt_overflow) > show options

Module options (auxiliary/scanner/telnet/telnet_encrypt_overflow):

   Name      Current Setting  Required  Description
   ----      ---------------  --------  -----------
   PASSWORD                   no        The password for the specified username
   RHOSTS                     yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
   RPORT     23               yes       The target port (TCP)
   THREADS   1                yes       The number of concurrent threads (max one per host)
   TIMEOUT   30               yes       Timeout for the Telnet probe
   USERNAME                   no        The username to authenticate as

Advanced Options


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

msf6 auxiliary(scanner/telnet/telnet_encrypt_overflow) > show advanced

Module advanced options (auxiliary/scanner/telnet/telnet_encrypt_overflow):

   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][...]
   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
   TelnetBannerTimeout  25               yes       The number of seconds to wait for the initial banner
   TelnetTimeout        10               yes       The number of seconds to wait for a reply from a Telnet command
   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/telnet/telnet_encrypt_overflow module can do:

msf6 auxiliary(scanner/telnet/telnet_encrypt_overflow) > show actions

Auxiliary actions:

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

Evasion Options


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

msf6 auxiliary(scanner/telnet/telnet_encrypt_overflow) > 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.

<IP>:<RPORT> Does not support encryption: <BANNER_SANITIZED> <VALUE>


Here is a relevant code snippet related to the "<IP>:<RPORT> Does not support encryption: <BANNER_SANITIZED> <VALUE>" error message:

47:	        sock.put("\xff\xfa\x26\x00\x01\x01\x12\x13\x14\x15\x16\x17\x18\x19\xff\xf0")
48:	
49:	        loop do
50:	          data = sock.get_once(-1, to) rescue nil
51:	          if not data
52:	            print_status("#{ip}:#{rport} Does not support encryption: #{banner_sanitized} #{data.to_s.unpack("H*")[0]}")
53:	            return
54:	          end
55:	          break if data.index("\xff\xfa\x26\x02\x01")
56:	        end
57:	

<IP>:<RPORT> UNKNOWN: No response to the initial probe: <BANNER_SANITIZED>


Here is a relevant code snippet related to the "<IP>:<RPORT> UNKNOWN: No response to the initial probe: <BANNER_SANITIZED>" error message:

64:	          # Send a long, but within boundary Key ID
65:	          #
66:	          sock.put(buff_good)
67:	          data = sock.get_once(-1, 5) rescue nil
68:	          unless data
69:	            print_status("#{ip}:#{rport} UNKNOWN: No response to the initial probe: #{banner_sanitized}")
70:	            return
71:	          end
72:	
73:	          unless data.index("\xff\xfa\x26\x08\xff\xf0")
74:	            print_status("#{ip}:#{rport} UNKNOWN: Invalid reply to Key ID: #{data.unpack("H*")[0]} - #{banner_sanitized}")

<IP>:<RPORT> UNKNOWN: Invalid reply to Key ID: <VALUE> - <BANNER_SANITIZED>


Here is a relevant code snippet related to the "<IP>:<RPORT> UNKNOWN: Invalid reply to Key ID: <VALUE> - <BANNER_SANITIZED>" error message:

69:	            print_status("#{ip}:#{rport} UNKNOWN: No response to the initial probe: #{banner_sanitized}")
70:	            return
71:	          end
72:	
73:	          unless data.index("\xff\xfa\x26\x08\xff\xf0")
74:	            print_status("#{ip}:#{rport} UNKNOWN: Invalid reply to Key ID: #{data.unpack("H*")[0]} - #{banner_sanitized}")
75:	            return
76:	          end
77:	
78:	          #
79:	          # First round to overwrite the function pointer itself

<IP>:<RPORT> NOT VULNERABLE: No reply to first long Key ID: <BANNER_SANITIZED>


Here is a relevant code snippet related to the "<IP>:<RPORT> NOT VULNERABLE: No reply to first long Key ID: <BANNER_SANITIZED>" error message:

79:	          # First round to overwrite the function pointer itself
80:	          #
81:	          sock.put(buff_long)
82:	          data = sock.get_once(-1, 5)
83:	          unless data
84:	            print_status("#{ip}:#{rport} NOT VULNERABLE: No reply to first long Key ID: #{banner_sanitized}")
85:	            return
86:	          end
87:	
88:	          unless data.index("\xff\xfa\x26\x08\xff\xf0")
89:	            print_status("#{ip}:#{rport} UNKNOWN: Invalid reply to first Key ID: #{data.unpack("H*")[0]} - #{banner_sanitized}")

<IP>:<RPORT> UNKNOWN: Invalid reply to first Key ID: <VALUE> - <BANNER_SANITIZED>


Here is a relevant code snippet related to the "<IP>:<RPORT> UNKNOWN: Invalid reply to first Key ID: <VALUE> - <BANNER_SANITIZED>" error message:

84:	            print_status("#{ip}:#{rport} NOT VULNERABLE: No reply to first long Key ID: #{banner_sanitized}")
85:	            return
86:	          end
87:	
88:	          unless data.index("\xff\xfa\x26\x08\xff\xf0")
89:	            print_status("#{ip}:#{rport} UNKNOWN: Invalid reply to first Key ID: #{data.unpack("H*")[0]} - #{banner_sanitized}")
90:	            return
91:	          end
92:	
93:	          #
94:	          # Second round to force the function to be called

<IP>:<RPORT> NOT VULNERABLE: No reply to second long Key ID: <BANNER_SANITIZED>


Here is a relevant code snippet related to the "<IP>:<RPORT> NOT VULNERABLE: No reply to second long Key ID: <BANNER_SANITIZED>" error message:

94:	          # Second round to force the function to be called
95:	          #
96:	          sock.put(buff_long)
97:	          data = sock.get_once(-1, 5)
98:	          unless data
99:	            print_status("#{ip}:#{rport} NOT VULNERABLE: No reply to second long Key ID: #{banner_sanitized}")
100:	            return
101:	          end
102:	
103:	          unless data.index("\xff\xfa\x26\x08\xff\xf0")
104:	            print_status("#{ip}:#{rport} UNKNOWN: Invalid reply to second Key ID: #{data.unpack("H*")[0]} - #{banner_sanitized}")

<IP>:<RPORT> UNKNOWN: Invalid reply to second Key ID: <VALUE> - <BANNER_SANITIZED>


Here is a relevant code snippet related to the "<IP>:<RPORT> UNKNOWN: Invalid reply to second Key ID: <VALUE> - <BANNER_SANITIZED>" error message:

99:	            print_status("#{ip}:#{rport} NOT VULNERABLE: No reply to second long Key ID: #{banner_sanitized}")
100:	            return
101:	          end
102:	
103:	          unless data.index("\xff\xfa\x26\x08\xff\xf0")
104:	            print_status("#{ip}:#{rport} UNKNOWN: Invalid reply to second Key ID: #{data.unpack("H*")[0]} - #{banner_sanitized}")
105:	            return
106:	          end
107:	
108:	          print_status("#{ip}:#{rport} NOT VULNERABLE: Service did not disconnect: #{banner_sanitized}")
109:	          return

<IP>:<RPORT> NOT VULNERABLE: Service did not disconnect: <BANNER_SANITIZED>


Here is a relevant code snippet related to the "<IP>:<RPORT> NOT VULNERABLE: Service did not disconnect: <BANNER_SANITIZED>" error message:

103:	          unless data.index("\xff\xfa\x26\x08\xff\xf0")
104:	            print_status("#{ip}:#{rport} UNKNOWN: Invalid reply to second Key ID: #{data.unpack("H*")[0]} - #{banner_sanitized}")
105:	            return
106:	          end
107:	
108:	          print_status("#{ip}:#{rport} NOT VULNERABLE: Service did not disconnect: #{banner_sanitized}")
109:	          return
110:	
111:	        rescue ::EOFError
112:	        end
113:	

A network issue has occurred: <E.MESSAGE>


Here is a relevant code snippet related to the "A network issue has occurred: <E.MESSAGE>" error message:

123:	          }
124:	        )
125:	
126:	      end
127:	    rescue ::Rex::ConnectionError, ::Errno::ECONNRESET => e
128:	      print_error("A network issue has occurred: #{e.message}")
129:	      elog('A network issue has occurred', error: e)
130:	    rescue Timeout::Error => e
131:	      print_error("#{target_host}:#{rport} Timed out after #{to} seconds")
132:	      elog("#{target_host}:#{rport} Timed out after #{to} seconds", error: e)
133:	    rescue ::Exception => e

A network issue has occurred


Here is a relevant code snippet related to the "A network issue has occurred" error message:

124:	        )
125:	
126:	      end
127:	    rescue ::Rex::ConnectionError, ::Errno::ECONNRESET => e
128:	      print_error("A network issue has occurred: #{e.message}")
129:	      elog('A network issue has occurred', error: e)
130:	    rescue Timeout::Error => e
131:	      print_error("#{target_host}:#{rport} Timed out after #{to} seconds")
132:	      elog("#{target_host}:#{rport} Timed out after #{to} seconds", error: e)
133:	    rescue ::Exception => e
134:	      print_error("#{target_host}:#{rport} Error: #{e} #{e.backtrace}")

<TARGET_HOST>:<RPORT> Timed out after <TO> seconds


Here is a relevant code snippet related to the "<TARGET_HOST>:<RPORT> Timed out after <TO> seconds" error message:

126:	      end
127:	    rescue ::Rex::ConnectionError, ::Errno::ECONNRESET => e
128:	      print_error("A network issue has occurred: #{e.message}")
129:	      elog('A network issue has occurred', error: e)
130:	    rescue Timeout::Error => e
131:	      print_error("#{target_host}:#{rport} Timed out after #{to} seconds")
132:	      elog("#{target_host}:#{rport} Timed out after #{to} seconds", error: e)
133:	    rescue ::Exception => e
134:	      print_error("#{target_host}:#{rport} Error: #{e} #{e.backtrace}")
135:	      elog("#{target_host}:#{rport} Error: #{e} #{e.backtrace}", error: e)
136:	    ensure

<TARGET_HOST>:<RPORT> Timed out after <TO> seconds


Here is a relevant code snippet related to the "<TARGET_HOST>:<RPORT> Timed out after <TO> seconds" error message:

127:	    rescue ::Rex::ConnectionError, ::Errno::ECONNRESET => e
128:	      print_error("A network issue has occurred: #{e.message}")
129:	      elog('A network issue has occurred', error: e)
130:	    rescue Timeout::Error => e
131:	      print_error("#{target_host}:#{rport} Timed out after #{to} seconds")
132:	      elog("#{target_host}:#{rport} Timed out after #{to} seconds", error: e)
133:	    rescue ::Exception => e
134:	      print_error("#{target_host}:#{rport} Error: #{e} #{e.backtrace}")
135:	      elog("#{target_host}:#{rport} Error: #{e} #{e.backtrace}", error: e)
136:	    ensure
137:	      disconnect

<TARGET_HOST>:<RPORT> Error: <E> <E.BACKTRACE>


Here is a relevant code snippet related to the "<TARGET_HOST>:<RPORT> Error: <E> <E.BACKTRACE>" error message:

129:	      elog('A network issue has occurred', error: e)
130:	    rescue Timeout::Error => e
131:	      print_error("#{target_host}:#{rport} Timed out after #{to} seconds")
132:	      elog("#{target_host}:#{rport} Timed out after #{to} seconds", error: e)
133:	    rescue ::Exception => e
134:	      print_error("#{target_host}:#{rport} Error: #{e} #{e.backtrace}")
135:	      elog("#{target_host}:#{rport} Error: #{e} #{e.backtrace}", error: e)
136:	    ensure
137:	      disconnect
138:	    end
139:	  end

<TARGET_HOST>:<RPORT> Error: <E> <E.BACKTRACE>


Here is a relevant code snippet related to the "<TARGET_HOST>:<RPORT> Error: <E> <E.BACKTRACE>" error message:

130:	    rescue Timeout::Error => e
131:	      print_error("#{target_host}:#{rport} Timed out after #{to} seconds")
132:	      elog("#{target_host}:#{rport} Timed out after #{to} seconds", error: e)
133:	    rescue ::Exception => e
134:	      print_error("#{target_host}:#{rport} Error: #{e} #{e.backtrace}")
135:	      elog("#{target_host}:#{rport} Error: #{e} #{e.backtrace}", error: e)
136:	    ensure
137:	      disconnect
138:	    end
139:	  end
140:	end

Go back to menu.


References


See Also


Check also the following modules related to this module:

Related Nessus plugins:

Authors


  • Jaime Penalba Estebanez <jpenalbae[at]gmail.com>
  • hdm

Version


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

Go back to menu.