2007-02-18 01:17:45 +00:00
|
|
|
##
|
2010-04-30 08:40:19 +00:00
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
2007-02-18 01:17:45 +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/
|
2007-02-18 01:17:45 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
class Metasploit3 < Msf::Auxiliary
|
2007-02-18 01:17:45 +00:00
|
|
|
|
|
|
|
# Exploit mixins should be called first
|
2008-10-02 05:23:59 +00:00
|
|
|
include Msf::Exploit::Remote::SMB
|
2010-08-12 15:00:58 +00:00
|
|
|
include Msf::Exploit::Remote::SMB::Authenticated
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2007-02-18 01:17:45 +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-07-01 23:33:07 +00:00
|
|
|
|
2007-02-18 01:17:45 +00:00
|
|
|
def initialize
|
|
|
|
super(
|
|
|
|
'Name' => 'SMB Session Pipe Auditor',
|
|
|
|
'Description' => 'Determine what named pipes are accessible over SMB',
|
|
|
|
'Author' => 'hdm',
|
|
|
|
'License' => MSF_LICENSE
|
|
|
|
)
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2007-02-18 01:17:45 +00:00
|
|
|
deregister_options('RPORT')
|
|
|
|
end
|
|
|
|
|
|
|
|
@@target_pipes = [
|
|
|
|
'netlogon',
|
|
|
|
'lsarpc',
|
|
|
|
'samr',
|
|
|
|
'browser',
|
|
|
|
'atsvc',
|
|
|
|
'DAV RPC SERVICE',
|
|
|
|
'epmapper',
|
|
|
|
'eventlog',
|
|
|
|
'InitShutdown',
|
|
|
|
'keysvc',
|
|
|
|
'lsass',
|
|
|
|
'LSM_API_service',
|
|
|
|
'ntsvcs',
|
|
|
|
'plugplay',
|
|
|
|
'protected_storage',
|
|
|
|
'router',
|
|
|
|
'SapiServerPipeS-1-5-5-0-70123',
|
|
|
|
'scerpc',
|
|
|
|
'srvsvc',
|
|
|
|
'tapsrv',
|
|
|
|
'trkwks',
|
|
|
|
'W32TIME_ALT',
|
|
|
|
'wkssvc',
|
2010-04-14 00:59:32 +00:00
|
|
|
'PIPE_EVENTROOT\CIMV2SCM EVENT PROVIDER',
|
|
|
|
'db2remotecmd'
|
2007-02-18 01:17:45 +00:00
|
|
|
]
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2007-02-18 01:17:45 +00:00
|
|
|
# Fingerprint a single host
|
|
|
|
def run_host(ip)
|
|
|
|
|
|
|
|
pass = []
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2007-02-18 01:17:45 +00:00
|
|
|
[[139, false], [445, true]].each do |info|
|
|
|
|
|
2009-03-28 05:49:33 +00:00
|
|
|
datastore['RPORT'] = info[0]
|
2007-02-18 01:17:45 +00:00
|
|
|
datastore['SMBDirect'] = info[1]
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2007-02-18 01:17:45 +00:00
|
|
|
begin
|
|
|
|
connect()
|
|
|
|
smb_login()
|
|
|
|
@@target_pipes.each do |pipe|
|
|
|
|
begin
|
|
|
|
fid = smb_create("\\#{pipe}")
|
|
|
|
# print_status("Opened pipe \\#{pipe}")
|
|
|
|
pass.push(pipe)
|
|
|
|
rescue ::Rex::Proto::SMB::Exceptions::ErrorCode => e
|
|
|
|
# print_error("Could not open \\#{pipe}: Error 0x%.8x" % e.error_code)
|
|
|
|
end
|
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2007-02-18 01:17:45 +00:00
|
|
|
disconnect()
|
|
|
|
|
|
|
|
break
|
|
|
|
rescue ::Exception => e
|
2008-01-22 06:21:03 +00:00
|
|
|
# print_line($!.to_s)
|
2010-04-30 08:40:19 +00:00
|
|
|
# print_line($!.backtrace.join("\n"))
|
2007-02-18 01:17:45 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if(pass.length > 0)
|
2008-01-24 05:45:18 +00:00
|
|
|
print_status("#{ip} - Pipes: #{pass.map{|c| "\\#{c}"}.join(", ")}")
|
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 => 'smb',
|
2010-06-17 14:03:53 +00:00
|
|
|
:port => rport,
|
|
|
|
:type => 'Pipes Founded',
|
|
|
|
:data => "Pipes: #{pass.map{|c| "\\#{c}"}.join(", ")}"
|
|
|
|
)
|
2007-02-18 01:17:45 +00:00
|
|
|
end
|
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2007-02-18 01:17:45 +00:00
|
|
|
|
2009-03-28 05:49:33 +00:00
|
|
|
end
|