2017-07-13 22:53:59 +00:00
|
|
|
##
|
2017-07-24 13:26:21 +00:00
|
|
|
# This module requires Metasploit: https://metasploit.com/download
|
2017-07-13 22:53:59 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
|
|
|
##
|
|
|
|
|
2016-03-08 13:02:44 +00:00
|
|
|
class MetasploitModule < Msf::Auxiliary
|
2014-12-11 08:40:20 +00:00
|
|
|
include Msf::Exploit::Remote::Tcp
|
|
|
|
include Msf::Auxiliary::Scanner
|
2014-12-12 19:57:35 +00:00
|
|
|
include Msf::Auxiliary::Report
|
2014-12-11 03:37:35 +00:00
|
|
|
|
2014-12-15 20:28:10 +00:00
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'Kippo SSH Honeypot Detector',
|
|
|
|
'Description' => %q{
|
|
|
|
This module will detect if an SSH server is running a Kippo honeypot.
|
|
|
|
This is done by issuing unexpected data to the SSH service and checking
|
|
|
|
the response returned for two particular non-standard error messages.
|
|
|
|
},
|
|
|
|
'Author' => 'Andrew Morris <andrew[at]morris.guru>',
|
|
|
|
'References' => [
|
2018-03-26 21:40:59 +00:00
|
|
|
['URL', 'https://www.obscurechannel.com/x42/magicknumber.html'],
|
2014-12-15 20:28:10 +00:00
|
|
|
['URL', 'http://morris.guru/detecting-kippo-ssh-honeypots/']
|
|
|
|
],
|
|
|
|
'License' => MSF_LICENSE
|
|
|
|
))
|
|
|
|
|
|
|
|
register_options([
|
|
|
|
Opt::RPORT(22)
|
|
|
|
])
|
2014-12-11 08:40:20 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def run_host(ip)
|
|
|
|
connect
|
2014-12-17 18:46:12 +00:00
|
|
|
banner = sock.get_once || ''
|
2014-12-15 20:28:10 +00:00
|
|
|
sock.put(banner + "\n" * 8)
|
2014-12-17 18:46:12 +00:00
|
|
|
response = sock.get_once || ''
|
2014-12-15 20:28:10 +00:00
|
|
|
|
|
|
|
if response =~ /(?:^Protocol mismatch\.\n$|bad packet length)/
|
|
|
|
print_good("#{ip}:#{rport} - Kippo detected!")
|
|
|
|
report_service(
|
|
|
|
:host => ip,
|
|
|
|
:port => rport,
|
|
|
|
:name => 'ssh',
|
|
|
|
:info => 'Kippo SSH honeypot'
|
|
|
|
)
|
|
|
|
else
|
|
|
|
vprint_status("#{ip}:#{rport} - #{banner.strip} detected")
|
2014-12-11 08:40:20 +00:00
|
|
|
end
|
|
|
|
end
|
2014-12-15 20:28:10 +00:00
|
|
|
end
|