2008-06-06 04:29:41 +00:00
|
|
|
##
|
2010-04-30 08:40:19 +00:00
|
|
|
# $Id$
|
|
|
|
##
|
|
|
|
|
|
|
|
##
|
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
2008-06-06 04:29:41 +00:00
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
2012-02-21 01:40:50 +00:00
|
|
|
# web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/
|
2008-06-06 04:29:41 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
2010-11-14 03:37:45 +00:00
|
|
|
require 'rex/proto/rfb'
|
2008-06-06 04:29:41 +00:00
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
class Metasploit3 < Msf::Auxiliary
|
2008-06-06 04:29:41 +00:00
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
include Msf::Exploit::Remote::Tcp
|
2010-02-05 21:13:07 +00:00
|
|
|
include Msf::Auxiliary::Report
|
2008-10-02 05:23:59 +00:00
|
|
|
include Msf::Auxiliary::Scanner
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2008-06-06 04:29:41 +00:00
|
|
|
def initialize
|
|
|
|
super(
|
|
|
|
'Name' => 'VNC Authentication None Detection',
|
2008-06-06 04:39:44 +00:00
|
|
|
'Version' => '$Revision$',
|
2010-11-14 03:37:45 +00:00
|
|
|
'Description' => 'Detect VNC servers that support the "None" authentication method.',
|
2008-06-06 04:29:41 +00:00
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
['URL', 'http://en.wikipedia.org/wiki/RFB'],
|
|
|
|
['URL', 'http://en.wikipedia.org/wiki/Vnc'],
|
|
|
|
],
|
2010-11-14 03:37:45 +00:00
|
|
|
'Author' =>
|
|
|
|
[
|
|
|
|
'Matteo Cantoni <goony[at]nothink.org>',
|
|
|
|
'jduck'
|
|
|
|
],
|
2008-06-06 04:29:41 +00:00
|
|
|
'License' => MSF_LICENSE
|
|
|
|
)
|
|
|
|
|
|
|
|
register_options(
|
2010-11-14 03:37:45 +00:00
|
|
|
[
|
|
|
|
Opt::RPORT(5900)
|
|
|
|
], self.class)
|
2008-06-06 04:29:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def run_host(target_host)
|
|
|
|
connect
|
|
|
|
|
2009-10-18 20:59:35 +00:00
|
|
|
begin
|
2010-11-14 03:37:45 +00:00
|
|
|
vnc = Rex::Proto::RFB::Client.new(sock)
|
|
|
|
if not vnc.handshake
|
|
|
|
raise RuntimeError.new("Handshake failed: #{vnc.error}")
|
|
|
|
end
|
|
|
|
|
|
|
|
ver = "#{vnc.majver}.#{vnc.minver}"
|
|
|
|
print_status("#{target_host}:#{rport}, VNC server protocol version : #{ver}")
|
2012-06-18 04:39:20 +00:00
|
|
|
svc = report_service(
|
2010-11-14 03:37:45 +00:00
|
|
|
:host => rhost,
|
|
|
|
:port => rport,
|
|
|
|
:proto => 'tcp',
|
|
|
|
:name => 'vnc',
|
|
|
|
:info => "VNC protocol version #{ver}"
|
|
|
|
)
|
|
|
|
|
|
|
|
type = vnc.negotiate_authentication
|
|
|
|
if not type
|
|
|
|
raise RuntimeError.new("Auth negotiation failed: #{vnc.error}")
|
|
|
|
end
|
|
|
|
|
|
|
|
# Show the allowed security types
|
|
|
|
sec_type = []
|
|
|
|
vnc.auth_types.each { |type|
|
|
|
|
sec_type << Rex::Proto::RFB::AuthType.to_s(type)
|
|
|
|
}
|
|
|
|
print_status("#{target_host}:#{rport}, VNC server security types supported : #{sec_type.join(",")}")
|
|
|
|
|
|
|
|
if (vnc.auth_types.include? Rex::Proto::RFB::AuthType::None)
|
|
|
|
print_good("#{target_host}:#{rport}, VNC server security types includes None, free access!")
|
|
|
|
report_vuln(
|
|
|
|
{
|
2012-06-18 04:39:20 +00:00
|
|
|
:host => rhost,
|
|
|
|
:service => svc,
|
|
|
|
:name => self.name,
|
|
|
|
:info => "Module #{self.fullname} identified the VNC 'none' security type: #{sec_type.join(", ")}",
|
|
|
|
:refs => self.references,
|
2011-05-15 22:19:00 +00:00
|
|
|
:exploited_at => Time.now.utc
|
2010-11-14 03:37:45 +00:00
|
|
|
})
|
2008-06-06 04:29:41 +00:00
|
|
|
end
|
|
|
|
|
2010-11-14 03:37:45 +00:00
|
|
|
rescue RuntimeError
|
|
|
|
print_error("#{target_host}:#{rport}, #{$!}")
|
|
|
|
raise $!
|
|
|
|
|
2009-10-18 20:59:35 +00:00
|
|
|
ensure
|
|
|
|
disconnect
|
|
|
|
end
|
2010-11-14 03:37:45 +00:00
|
|
|
|
2008-06-06 04:29:41 +00:00
|
|
|
end
|
2009-10-18 20:59:35 +00:00
|
|
|
end
|