2008-10-15 15:15:29 +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-10-15 15:15:29 +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::Scanner
|
|
|
|
include Msf::Auxiliary::Report
|
|
|
|
|
|
|
|
def initialize
|
|
|
|
super(
|
|
|
|
'Name' => 'X11 No-Auth Scanner',
|
|
|
|
'Description' => %q{
|
|
|
|
This module scans for X11 servers that allow anyone
|
|
|
|
to connect without authentication.
|
|
|
|
},
|
|
|
|
'Author' => ['tebo <tebodell[at]gmail.com>'],
|
|
|
|
'References' =>
|
|
|
|
[
|
2016-07-15 17:00:31 +00:00
|
|
|
['OSVDB', '309'],
|
2013-08-30 21:28:54 +00:00
|
|
|
['CVE', '1999-0526'],
|
|
|
|
],
|
|
|
|
'License' => MSF_LICENSE
|
|
|
|
)
|
|
|
|
|
|
|
|
register_options([
|
|
|
|
Opt::RPORT(6000)
|
2017-05-03 20:42:21 +00:00
|
|
|
])
|
2013-08-30 21:28:54 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def run_host(ip)
|
|
|
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
connect
|
|
|
|
|
|
|
|
# X11.00 Null Auth Connect
|
|
|
|
sock.put("\x6c\x00\x0b\x00\x00\x00\x00\x00\x00\x00\x00\x00")
|
|
|
|
response = sock.get_once
|
|
|
|
|
|
|
|
disconnect
|
|
|
|
|
2014-12-17 18:46:12 +00:00
|
|
|
if response
|
2013-08-30 21:28:54 +00:00
|
|
|
success = response[0,1].unpack('C')[0]
|
2014-12-17 18:46:12 +00:00
|
|
|
else
|
|
|
|
print_error("No response received due to a timeout")
|
|
|
|
return
|
2013-08-30 21:28:54 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if(success == 1)
|
|
|
|
vendor_len = response[24,2].unpack('v')[0]
|
|
|
|
vendor = response[40,vendor_len].unpack('A*')[0]
|
2016-10-31 16:29:00 +00:00
|
|
|
print_good("#{ip} Open X Server (#{vendor})")
|
2015-04-03 11:12:23 +00:00
|
|
|
# Add Report
|
2013-08-30 21:28:54 +00:00
|
|
|
report_note(
|
|
|
|
:host => ip,
|
|
|
|
:proto => 'tcp',
|
|
|
|
:sname => 'x11',
|
|
|
|
:port => rport,
|
|
|
|
:type => 'Open X Server',
|
|
|
|
:data => "Open X Server (#{vendor})"
|
|
|
|
)
|
|
|
|
elsif (success == 0)
|
2016-10-31 16:29:00 +00:00
|
|
|
print_error("#{ip} Access Denied")
|
2013-08-30 21:28:54 +00:00
|
|
|
else
|
|
|
|
# X can return a reason for auth failure but we don't really care for this
|
|
|
|
end
|
|
|
|
|
|
|
|
rescue ::Rex::ConnectionError
|
|
|
|
rescue ::Errno::EPIPE
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2008-11-11 05:12:52 +00:00
|
|
|
end
|