2007-10-04 03:03:13 +00:00
|
|
|
##
|
|
|
|
# $Id$
|
|
|
|
##
|
|
|
|
|
|
|
|
##
|
|
|
|
# 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/
|
2007-10-04 03:03:13 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
class Metasploit3 < Msf::Auxiliary
|
2007-10-04 03:03:13 +00:00
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
include Msf::Exploit::Remote::Tcp
|
2007-10-04 03:03:13 +00:00
|
|
|
|
|
|
|
# Scanner mixin should be near last
|
2008-10-02 05:23:59 +00:00
|
|
|
include Msf::Auxiliary::Scanner
|
2010-06-17 14:03:53 +00:00
|
|
|
include Msf::Auxiliary::Report
|
2010-06-21 16:53:52 +00:00
|
|
|
|
2007-10-04 03:03:13 +00:00
|
|
|
def initialize
|
|
|
|
super(
|
|
|
|
'Name' => 'Borland InterBase Services Manager Information',
|
|
|
|
'Description' => %q{
|
|
|
|
This module retrieves version of the services manager, version
|
|
|
|
and implementation of the InterBase server from InterBase
|
|
|
|
Services Manager.
|
|
|
|
},
|
|
|
|
'Version' => '$Revision$',
|
|
|
|
'Author' =>
|
|
|
|
[
|
2012-09-19 14:55:30 +00:00
|
|
|
'Ramon de C Valle',
|
2012-06-04 20:31:10 +00:00
|
|
|
'Adriano Lima <adriano[at]risesecurity.org>',
|
2007-10-04 03:03:13 +00:00
|
|
|
],
|
|
|
|
'License' => MSF_LICENSE
|
|
|
|
)
|
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
Opt::RPORT(3050)
|
|
|
|
],
|
|
|
|
self.class
|
|
|
|
)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
# Create service parameter block
|
|
|
|
def spb_create
|
|
|
|
isc_dpb_user_name = 28
|
|
|
|
isc_dpb_password = 29
|
|
|
|
|
|
|
|
isc_spb_user_name = isc_dpb_user_name
|
|
|
|
isc_spb_password = isc_dpb_password
|
|
|
|
|
|
|
|
isc_spb_current_version = 2
|
|
|
|
isc_spb_version = isc_spb_current_version
|
|
|
|
|
|
|
|
user = 'SYSDBA'
|
|
|
|
pass = 'masterkey'
|
|
|
|
|
|
|
|
spb = ''
|
|
|
|
|
|
|
|
spb << [isc_spb_version].pack('c')
|
|
|
|
spb << [isc_spb_current_version].pack('c')
|
|
|
|
|
|
|
|
spb << [isc_spb_user_name].pack('c')
|
|
|
|
spb << [user.length].pack('c')
|
|
|
|
spb << user
|
|
|
|
|
|
|
|
spb << [isc_spb_password].pack('c')
|
|
|
|
spb << [pass.length].pack('c')
|
|
|
|
spb << pass
|
|
|
|
|
|
|
|
spb
|
|
|
|
end
|
|
|
|
|
|
|
|
# Create receive buffer
|
|
|
|
def recv_spb_create
|
|
|
|
# Retrieves the version of the services manager
|
|
|
|
isc_info_svc_version = 54
|
|
|
|
|
|
|
|
# Retrieves the version of the InterBase server
|
|
|
|
isc_info_svc_server_version = 55
|
|
|
|
|
|
|
|
# Retrieves the implementation of the InterBase server
|
|
|
|
isc_info_svc_implementation = 56
|
|
|
|
|
|
|
|
recv_spb = ''
|
|
|
|
|
|
|
|
recv_spb << [isc_info_svc_version].pack('c')
|
|
|
|
recv_spb << [isc_info_svc_server_version].pack('c')
|
|
|
|
recv_spb << [isc_info_svc_implementation].pack('c')
|
|
|
|
|
|
|
|
recv_spb
|
|
|
|
end
|
|
|
|
|
|
|
|
# Calculate buffer padding
|
|
|
|
def buf_padding(length = '')
|
|
|
|
remainder = length.remainder(4)
|
|
|
|
padding = 0
|
|
|
|
|
|
|
|
if remainder > 0
|
|
|
|
padding = (4 - remainder)
|
|
|
|
end
|
|
|
|
|
|
|
|
padding
|
|
|
|
end
|
|
|
|
|
|
|
|
def run_host(ip)
|
|
|
|
|
|
|
|
#
|
|
|
|
# Using the InterBase Services Manager
|
|
|
|
# http://dn.codegear.com/article/27002
|
|
|
|
#
|
|
|
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
print_status("Trying #{ip}")
|
|
|
|
|
|
|
|
connect
|
|
|
|
|
|
|
|
# isc_service_attach
|
|
|
|
|
|
|
|
# Service name
|
|
|
|
svc_name = 'service_mgr'
|
|
|
|
|
|
|
|
# Service attach
|
|
|
|
op_service_attach = 82
|
|
|
|
|
|
|
|
buf = ''
|
|
|
|
|
|
|
|
# Operation/packet type
|
|
|
|
buf << [op_service_attach].pack('N')
|
|
|
|
|
|
|
|
# Id
|
|
|
|
buf << [0].pack('N')
|
|
|
|
|
|
|
|
# Length
|
|
|
|
buf << [svc_name.length].pack('N')
|
|
|
|
|
|
|
|
# Service name
|
|
|
|
buf << svc_name
|
|
|
|
|
|
|
|
# Padding
|
|
|
|
buf << "\x00" * buf_padding(svc_name.length)
|
|
|
|
|
|
|
|
# Create service parameter block
|
|
|
|
spb = spb_create
|
|
|
|
|
|
|
|
# Service parameter block length
|
|
|
|
buf << [spb.length].pack('N')
|
|
|
|
|
|
|
|
# Service parameter block
|
|
|
|
buf << spb
|
|
|
|
|
|
|
|
# Padding
|
|
|
|
buf << "\x00" * buf_padding(spb.length)
|
|
|
|
|
|
|
|
sock.put(buf)
|
|
|
|
|
|
|
|
response = sock.get_once
|
|
|
|
|
|
|
|
# print(Rex::Text.to_hex_dump(response))
|
|
|
|
|
|
|
|
|
|
|
|
# isc_service_query
|
|
|
|
|
|
|
|
# Response buffer length
|
|
|
|
response_buffer_length = 64
|
|
|
|
|
|
|
|
# Service info
|
|
|
|
op_service_info = 84
|
|
|
|
|
|
|
|
buf = ''
|
|
|
|
|
|
|
|
# Operation/packet type
|
|
|
|
buf << [op_service_info].pack('N')
|
|
|
|
|
|
|
|
# Id
|
|
|
|
buf << [0].pack('N')
|
|
|
|
|
|
|
|
# ?
|
|
|
|
buf << [0].pack('N')
|
|
|
|
|
|
|
|
# ?
|
|
|
|
buf << [0].pack('N')
|
|
|
|
|
|
|
|
# Create receive buffer
|
|
|
|
recv_spb = recv_spb_create
|
|
|
|
|
|
|
|
# Receive buffer length
|
|
|
|
buf << [recv_spb.length].pack('N')
|
|
|
|
|
|
|
|
# Receive buffer
|
|
|
|
buf << recv_spb
|
|
|
|
|
|
|
|
# Padding
|
|
|
|
buf << "\x00" * buf_padding(recv_spb.length)
|
|
|
|
|
|
|
|
# Response buffer length
|
|
|
|
buf << [response_buffer_length].pack('N')
|
|
|
|
|
|
|
|
sock.put(buf)
|
|
|
|
|
|
|
|
response = sock.get_once
|
|
|
|
|
|
|
|
res = response.unpack('x28Z*Z*')
|
|
|
|
|
|
|
|
info_svc_server_version = res[0].chop.chop
|
|
|
|
info_svc_implementation = res[1].chop
|
|
|
|
|
|
|
|
print("IP Address: #{ip}\n")
|
|
|
|
# print("Version of the services manager: #{info_svc_version}\n")
|
|
|
|
print("Version of the InterBase server: #{info_svc_server_version}\n")
|
|
|
|
print("Implementation of the InterBase server: #{info_svc_implementation}\n\n")
|
|
|
|
|
|
|
|
# print(Rex::Text.to_hex_dump(response))
|
2010-06-21 16:53:52 +00:00
|
|
|
|
2010-06-17 14:03:53 +00:00
|
|
|
#Add Report
|
|
|
|
report_note(
|
|
|
|
:host => ip,
|
2011-02-04 01:54:32 +00:00
|
|
|
:sname => 'ib',
|
|
|
|
:proto => 'tcp',
|
2010-06-17 14:03:53 +00:00
|
|
|
:port => rport,
|
|
|
|
:type => 'Version of the InterBase server',
|
|
|
|
:data => "Version of the InterBase server: #{info_svc_server_version}"
|
|
|
|
)
|
2010-06-21 16:53:52 +00:00
|
|
|
|
2010-06-17 14:03:53 +00:00
|
|
|
#Add Report
|
|
|
|
report_note(
|
|
|
|
:host => ip,
|
2011-02-04 01:54:32 +00:00
|
|
|
:sname => 'ib',
|
|
|
|
:proto => 'tcp',
|
2010-06-17 14:03:53 +00:00
|
|
|
:port => rport,
|
|
|
|
:type => 'Implementation of the InterBase server',
|
|
|
|
:data => "Implementation of the InterBase server: #{info_svc_implementation}"
|
|
|
|
)
|
2010-06-21 16:53:52 +00:00
|
|
|
|
2008-11-11 05:12:52 +00:00
|
|
|
rescue ::Rex::ConnectionError
|
|
|
|
rescue ::Errno::EPIPE
|
2007-10-04 03:03:13 +00:00
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2008-11-11 05:12:52 +00:00
|
|
|
end
|