Praetorian503 Posted February 5, 2013 Report Posted February 5, 2013 Nagios XI version 2012R1.5b suffers from cross site request forgery, cross site scripting, remote command injection, and remote SQL injection vulnerabilities.Reflected XSS:Alert Cloud Component:Example URL:http://nagiosxiserver/nagiosxi/includes/components/alertcloud/index.php?width=800"}};alert('xss'); var aa={"a" : {"b" : "The vulnerable code in Alert Cloud's index.php appears to have beencopied and pasted into several other components as well.Escalation Wizard:Example URL:http://nagiosxiserver/nagiosxi/includes/components/escalationwizard/escalationwizard.php?stage=4&config_name=ffffff'style='height:5000px;width:5000px;position:absolute;left:-1px;top:-1px'onmouseover='alert("xss")'/>Stored XSS:Nagios QL (aka Legacy Nagios Core Configuration Manager):Example:Using');alert('xssas the config name of a host escalation entry will result in thejavascript being executed when a user tries to delete that hostescalation entry.I believe that the Legacy Nagios Core Configuration Manager and the(regular, non legacy) Core Configuration Manager share configurationsettings in a database. I was unable to test whether script injectedvia Nagios QL could be executed by using the (regular) CoreConfiguration Manager because the (regular) Core Configuration Managerappears to be broken in this release (?).Command Execution:Autodiscovery does not filter input properly. Any user can submit newjobs, even regular user accounts with read only access. Autodiscoverymay not appear in the menu for some users, it may be necessary tobrowse directly to the autodiscovery page.Example (as the scan target): \; cat /etc/passwd \;Then look at the job results.Due to what seems to be (as far as I can tell) a very poorly thoughtout sudo rule, a user could upload a custom nmap script to the serverand run it (through sudo) for easy root access.Yes, there is a sudo rule that allows apache to run nmap as root.Autodiscovery requires manual activation before it can be used (andthis vulnerability exploited).Autodiscovery does use a nonce, but this can be bypassed with XSS.Not sure what to call this, content spoofing maybe?Whatever you would call it, this could be used for phishing (or whatever).Nagios XI Admin Panel:http://172.16.4.51/nagiosxi/admin/?xiwindow=http://w3c.orgSQL Injection:Sorry about the poor examples below, they should be enough todemonstrate the point though.NagiosQL (aka Legacy Nagios Core Configuration Manager):Example URL:http://nagiosxiserver/nagiosql/admin/commandline.php?cname=a'+or+'a'='aVulnerable Code:if (isset($_GET['cname']) && ($_GET['cname'] != "")) { $strResult = $myDBClass->getFieldData("SELECT command_lineFROM tbl_command WHERE id='".$_GET['cname']."'");There are other pages in NagiosQL that are also vulnerable.Escalation Wizard:Example URL:http://nagiosxiserver/nagiosxi/includes/components/escalationwizard/escalationwizard.php?stage=5&submitted=true&level='CSRF:NagiosQL (aka Legacy Nagios Core Configuration Manager)Escalation WizardConfiguration File Injection:Example URL:http://nagiosxiserver/nagiosxi/includes/components/escalationwizard/escalationwizard.php?config_name=CoolConfigDD&contacts[]=1&contactgroups[]=1&timeperiod=2&first=1&last=10&interval=1&done=false&stage=5&level=1&objecttype=host&submitted=true&options[]=d%0A}%0Adefinehost%0A%23The 'options' GET parameter is limited to 20 characters (VARCHAR 20 inthe DB) and is placed in the 'escalation_options' field in thehostescalations.cfg file.I'm not sure if it is possible to do anything useful with only 20characters, but I find it interesting none the less. The above examplecreates an empty host definition that doesn't mess up the config file.If an invalid configuration file is created, the last know goodconfiguration is rolled back and nagios is restarted, so this cannotbe used for denial of service.James ClawsonSource: PacketStorm Quote