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:
- <IP>:<RPORT> Does not support encryption: <BANNER_SANITIZED> <VALUE>
- <IP>:<RPORT> UNKNOWN: No response to the initial probe: <BANNER_SANITIZED>
- <IP>:<RPORT> UNKNOWN: Invalid reply to Key ID: <VALUE> - <BANNER_SANITIZED>
- <IP>:<RPORT> NOT VULNERABLE: No reply to first long Key ID: <BANNER_SANITIZED>
- <IP>:<RPORT> UNKNOWN: Invalid reply to first Key ID: <VALUE> - <BANNER_SANITIZED>
- <IP>:<RPORT> NOT VULNERABLE: No reply to second long Key ID: <BANNER_SANITIZED>
- <IP>:<RPORT> UNKNOWN: Invalid reply to second Key ID: <VALUE> - <BANNER_SANITIZED>
- <IP>:<RPORT> NOT VULNERABLE: Service did not disconnect: <BANNER_SANITIZED>
- A network issue has occurred: <E.MESSAGE>
- A network issue has occurred
- <TARGET_HOST>:<RPORT> Timed out after <TO> seconds
- <TARGET_HOST>:<RPORT> Timed out after <TO> seconds
- <TARGET_HOST>:<RPORT> Error: <E> <E.BACKTRACE>
- <TARGET_HOST>:<RPORT> Error: <E> <E.BACKTRACE>
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.
Related Pull Requests
- #13608 Merged Pull Request: Standardise Error Logging
- #12949 Merged Pull Request: This fixes broken links to the community.rapid7.com blog
- #9558 Merged Pull Request: Fix #9417, map timeout exp to a var for telnet_encrypt_overflow
- #8955 Merged Pull Request: Fix #8060
- #8716 Merged Pull Request: Print_Status -> Print_Good (And OCD bits 'n bobs)
- #8338 Merged Pull Request: Fix msf/core and self.class msftidy warnings
- #6655 Merged Pull Request: use MetasploitModule as a class name
- #6648 Merged Pull Request: Change metasploit class names
- #5277 Merged Pull Request: typo in title of telnet_encrypt_overflow.rb
- #2525 Merged Pull Request: Change module boilerplate
- #1228 Merged Pull Request: MSFTIDY cleanup #1 - auxiliary
- #958 Merged Pull Request: Msftidy 2
- #750 Merged Pull Request: Add Metasploit blogs as references, because they're useful.
- #259 Merged Pull Request: Convert Exploit-DB references to first-tier "EDB-12345" references
References
- BID-51182
- CVE-2011-4862
- EDB-18280
- https://blog.rapid7.com/2011/12/28/more-fun-with-bsd-derived-telnet-daemons
See Also
Check also the following modules related to this module:
- exploit/freebsd/telnet/telnet_encrypt_keyid
- exploit/linux/telnet/telnet_encrypt_keyid
- auxiliary/scanner/telnet/telnet_login
- auxiliary/scanner/telnet/telnet_ruggedcom
- auxiliary/scanner/telnet/telnet_version
- auxiliary/scanner/telnet/brocade_enable_login
- auxiliary/scanner/telnet/lantronix_telnet_password
- auxiliary/scanner/telnet/lantronix_telnet_version
- auxiliary/scanner/telnet/satel_cmd_exec
- exploit/linux/telnet/netgear_telnetenable
- exploit/solaris/telnet/fuser
- exploit/solaris/telnet/ttyprompt
- exploit/windows/telnet/gamsoft_telsrv_username
- exploit/windows/telnet/goodtech_telnet
- auxiliary/dos/cisco/ios_telnet_rocem
- auxiliary/server/capture/telnet
- auxiliary/dos/scada/d20_tftp_overflow
- auxiliary/dos/ssl/dtls_fragment_overflow
- auxiliary/dos/windows/smb/ms10_054_queryfs_pool_overflow
- exploit/freebsd/ftp/proftp_telnet_iac
- exploit/linux/ftp/proftp_telnet_iac
- exploit/linux/http/dlink_dir300_exec_telnet
- exploit/linux/http/tp_link_sc2020n_authenticated_telnet_injection
- exploit/windows/proxy/ccproxy_telnet_ping
- payload/cmd/unix/bind_busybox_telnetd
- payload/cmd/unix/reverse_bash_telnet_ssl
- payload/cmd/unix/reverse_ssl_double_telnet
- auxiliary/admin/http/netgear_r7000_backup_cgi_heap_overflow_rce
- exploit/windows/misc/hp_dataprotector_encrypted_comms
- post/osx/gather/apfs_encrypted_volume_passwd
Related Nessus plugins:
- FreeBSD : krb5-appl -- telnetd code execution vulnerability (4ddc78dc-300a-11e1-a2aa-0016ce01e285)
- CentOS 4 / 5 : krb5 (CESA-2011:1851)
- CentOS 6 : krb5-appl (CESA-2011:1852)
- RHEL 4 / 5 : krb5 (RHSA-2011:1851)
- RHEL 6 : krb5-appl (RHSA-2011:1852)
- Mandriva Linux Security Advisory : krb5-appl (MDVSA-2011:195)
- SuSE 11.1 Security Update : Kerberos 5 (SAT Patch Number 5594)
- SuSE 10 Security Update : Kerberos 5 (ZYPP Patch Number 7899)
- Fedora 15 : krb5-appl-1.0.1-8.fc15 (2011-17492)
- Fedora 16 : krb5-appl-1.0.2-2.fc16 (2011-17493)
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.