2008-10-15 15:15:29 +00:00
|
|
|
##
|
2008-11-16 03:03:19 +00:00
|
|
|
# $Id$
|
2008-10-15 15:15:29 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
##
|
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
|
|
|
# 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-10-15 15:15:29 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Auxiliary
|
|
|
|
|
|
|
|
include Msf::Exploit::Remote::Tcp
|
|
|
|
include Msf::Auxiliary::Scanner
|
2010-06-17 14:03:53 +00:00
|
|
|
include Msf::Auxiliary::Report
|
2010-06-21 16:53:52 +00:00
|
|
|
|
2008-10-15 15:15:29 +00:00
|
|
|
def initialize
|
|
|
|
super(
|
|
|
|
'Name' => 'X11 No-Auth Scanner',
|
2009-03-30 01:01:30 +00:00
|
|
|
'Version' => '$Revision$',
|
2008-10-15 15:15:29 +00:00
|
|
|
'Description' => %q{
|
|
|
|
This module scans for X11 servers that allow anyone
|
|
|
|
to connect without authentication.
|
|
|
|
},
|
2009-09-19 17:24:29 +00:00
|
|
|
'Author' => ['tebo <tebodell[at]gmail.com>'],
|
2008-10-15 15:15:29 +00:00
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
['OSVDB', '309'],
|
|
|
|
['CVE', '1999-0526'],
|
|
|
|
],
|
|
|
|
'License' => MSF_LICENSE
|
|
|
|
)
|
|
|
|
|
2009-09-19 17:24:29 +00:00
|
|
|
register_options([
|
|
|
|
Opt::RPORT(6000)
|
|
|
|
],self.class)
|
2008-10-15 15:15:29 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def run_host(ip)
|
|
|
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
connect
|
|
|
|
|
|
|
|
# X11.00 Null Auth Connect
|
2009-09-19 17:24:29 +00:00
|
|
|
sock.put("\x6c\x00\x0b\x00\x00\x00\x00\x00\x00\x00\x00\x00")
|
2008-10-15 15:15:29 +00:00
|
|
|
response = sock.get_once
|
2010-05-03 17:13:09 +00:00
|
|
|
|
2009-09-19 17:24:29 +00:00
|
|
|
disconnect
|
2010-06-21 16:53:52 +00:00
|
|
|
|
2009-09-19 17:24:29 +00:00
|
|
|
if(response)
|
|
|
|
success = response[0,1].unpack('C')[0]
|
2008-10-15 15:15:29 +00:00
|
|
|
end
|
|
|
|
|
2010-06-17 14:03:53 +00:00
|
|
|
|
2009-09-19 17:24:29 +00:00
|
|
|
if(success == 1)
|
|
|
|
vendor_len = response[24,2].unpack('v')[0]
|
|
|
|
vendor = response[40,vendor_len].unpack('A*')[0]
|
|
|
|
print_status("#{ip} Open X Server (#{vendor})")
|
2010-06-17 14:03:53 +00:00
|
|
|
#Add Report
|
|
|
|
report_note(
|
|
|
|
:host => ip,
|
2011-02-04 01:54:32 +00:00
|
|
|
:proto => 'tcp',
|
2011-02-22 20:49:44 +00:00
|
|
|
:sname => 'x11',
|
2010-06-17 14:03:53 +00:00
|
|
|
:port => rport,
|
|
|
|
:type => 'Open X Server',
|
|
|
|
:data => "Open X Server (#{vendor})"
|
|
|
|
)
|
2009-09-19 17:24:29 +00:00
|
|
|
elsif (success == 0)
|
|
|
|
print_status("#{ip} Access Denied")
|
2008-10-15 15:15:29 +00:00
|
|
|
else
|
|
|
|
# X can return a reason for auth failure but we don't really care for this
|
|
|
|
end
|
2010-05-03 17:13:09 +00:00
|
|
|
|
2008-11-11 05:12:52 +00:00
|
|
|
rescue ::Rex::ConnectionError
|
|
|
|
rescue ::Errno::EPIPE
|
2008-10-15 15:15:29 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2008-11-11 05:12:52 +00:00
|
|
|
end
|