2010-04-30 08:40:19 +00:00
|
|
|
##
|
2017-07-24 13:26:21 +00:00
|
|
|
# This module requires Metasploit: https://metasploit.com/download
|
2013-10-15 18:50:46 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
2008-06-06 04:29:41 +00:00
|
|
|
##
|
|
|
|
|
2010-11-14 03:37:45 +00:00
|
|
|
require 'rex/proto/rfb'
|
2008-06-06 04:29:41 +00:00
|
|
|
|
2016-03-08 13:02:44 +00:00
|
|
|
class MetasploitModule < Msf::Auxiliary
|
2013-08-30 21:28:54 +00:00
|
|
|
include Msf::Exploit::Remote::Tcp
|
|
|
|
include Msf::Auxiliary::Report
|
|
|
|
include Msf::Auxiliary::Scanner
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def initialize
|
|
|
|
super(
|
|
|
|
'Name' => 'VNC Authentication None Detection',
|
|
|
|
'Description' => 'Detect VNC servers that support the "None" authentication method.',
|
|
|
|
'References' =>
|
|
|
|
[
|
2017-06-05 21:25:02 +00:00
|
|
|
['CVE', '2006-2369'], # a related instance where "None" could be offered and used when not configured as allowed.
|
2013-08-30 21:28:54 +00:00
|
|
|
['URL', 'http://en.wikipedia.org/wiki/RFB'],
|
|
|
|
['URL', 'http://en.wikipedia.org/wiki/Vnc'],
|
|
|
|
],
|
|
|
|
'Author' =>
|
|
|
|
[
|
|
|
|
'Matteo Cantoni <goony[at]nothink.org>',
|
|
|
|
'jduck'
|
|
|
|
],
|
|
|
|
'License' => MSF_LICENSE
|
|
|
|
)
|
2008-06-06 04:29:41 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
Opt::RPORT(5900)
|
2017-05-03 20:42:21 +00:00
|
|
|
])
|
2013-08-30 21:28:54 +00:00
|
|
|
end
|
2008-06-06 04:29:41 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def run_host(target_host)
|
|
|
|
begin
|
2015-10-19 23:11:03 +00:00
|
|
|
connect
|
2013-08-30 21:28:54 +00:00
|
|
|
vnc = Rex::Proto::RFB::Client.new(sock)
|
2015-10-19 23:11:03 +00:00
|
|
|
unless vnc.handshake
|
|
|
|
print_error("#{target_host}:#{rport} - Handshake failed: #{vnc.error}")
|
|
|
|
return
|
2013-08-30 21:28:54 +00:00
|
|
|
end
|
2010-11-14 03:37:45 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
ver = "#{vnc.majver}.#{vnc.minver}"
|
2017-07-13 23:09:35 +00:00
|
|
|
print_good("#{target_host}:#{rport} - VNC server protocol version: #{ver}")
|
2013-08-30 21:28:54 +00:00
|
|
|
svc = report_service(
|
|
|
|
:host => rhost,
|
|
|
|
:port => rport,
|
|
|
|
:proto => 'tcp',
|
|
|
|
:name => 'vnc',
|
|
|
|
:info => "VNC protocol version #{ver}"
|
|
|
|
)
|
2010-11-14 03:37:45 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
type = vnc.negotiate_authentication
|
2015-10-19 23:11:03 +00:00
|
|
|
unless type
|
|
|
|
print_error("#{target_host}:#{rport} - Auth negotiation failed: #{vnc.error}")
|
|
|
|
return
|
2013-08-30 21:28:54 +00:00
|
|
|
end
|
2010-11-14 03:37:45 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
# Show the allowed security types
|
|
|
|
sec_type = []
|
|
|
|
vnc.auth_types.each { |type|
|
|
|
|
sec_type << Rex::Proto::RFB::AuthType.to_s(type)
|
|
|
|
}
|
2015-10-19 23:11:03 +00:00
|
|
|
print_status("#{target_host}:#{rport} - VNC server security types supported: #{sec_type.join(",")}")
|
2010-11-14 03:37:45 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
if (vnc.auth_types.include? Rex::Proto::RFB::AuthType::None)
|
2015-10-19 23:11:03 +00:00
|
|
|
print_good("#{target_host}:#{rport} - VNC server security types includes None, free access!")
|
2013-08-30 21:28:54 +00:00
|
|
|
report_vuln(
|
|
|
|
{
|
|
|
|
:host => rhost,
|
|
|
|
:service => svc,
|
|
|
|
:name => self.name,
|
|
|
|
:info => "Module #{self.fullname} identified the VNC 'none' security type: #{sec_type.join(", ")}",
|
|
|
|
:refs => self.references,
|
|
|
|
:exploited_at => Time.now.utc
|
|
|
|
})
|
|
|
|
end
|
|
|
|
ensure
|
|
|
|
disconnect
|
|
|
|
end
|
2010-11-14 03:37:45 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
end
|
2009-10-18 20:59:35 +00:00
|
|
|
end
|