TWSL2011-017: Multiple Vulnerabilities in Merethis Centreon

Type securityvulns
Reporter Securityvulns
Modified 2011-11-11T00:00:00


Trustwave's SpiderLabs Security Advisory TWSL2011-017: Multiple Vulnerabilities in Merethis Centreon

Published: 2011-11-04 Version: 1.0

Vendor: Merethis ( and Product: Centreon Version affected: 2.3.1 and prior

Product description: Centreon is network supervision and monitoring tool that is based upon the Nagios open source monitoring engine. Centreon can be used as a Nagios GUI and it can provide such features as real time system monitoring, performance management and system management.

Credit: Christophe De La Fuente of Trustwave SpiderLabs

Finding 1: Remote Command Execution

Centreon supervision and monitoring tool provided by Merethis permits remote code execution from the command help web page allowing an attacker to execute arbitrary commands in the context of the webserver hosting the application. Any account that has been granted the access to "Configuration > Nagios > Checks" is able to execute commands.

The following Proof of Concept (PoC) executes the command 'cat /etc/passwd':


Finding 2: One-Way Hash Without a Salt

The following code at lines 329-349 from www/include/configuration/nconfigObject/contact/DB-Func.php shows the insertContactInDB() function inserting the MD5 or SHA1 password hash in the database without using a salt:

$rq = "INSERT INTO `contact` ( " .
        "`contact_id` , `timeperiod_tp_id` , `timeperiod_tp_id2` ,
        `contact_name` , " .  "`contact_alias` , `contact_autologin_key` ,
        `contact_passwd` , `contact_lang` , `contact_template_id`, " .
        "`contact_host_notification_options` ,
        `contact_service_notification_options` , " .  "`contact_email` ,
        `contact_pager` , `contact_comment` , `contact_oreon`,
        `contact_register`, `contact_enable_notifications` , " .
        "`contact_admin` , `contact_type_msg`, `contact_activate`,
        `contact_auth_type`, " .  "`contact_ldap_dn`, `contact_location`,
        `contact_address1`, `contact_address2`, " .  "`contact_address3`,
        `contact_address4`, `contact_address5`, `contact_address6`)" .
        "VALUES ( ";
$rq .= "NULL, "; isset($ret["timeperiod_tp_id"]) && $ret["timeperiod_tp_id"]
!= NULL ? $rq .= "'".$ret["timeperiod_tp_id"]."', ": $rq .= "NULL, ";
isset($ret["timeperiod_tp_id2"]) && $ret["timeperiod_tp_id2"] != NULL ? $rq
.= "'".$ret["timeperiod_tp_id2"]."', ": $rq .= "NULL, ";
isset($ret["contact_name"]) && $ret["contact_name"] != NULL ? $rq .=
"'".htmlentities($ret["contact_name"], ENT_QUOTES, "UTF-8")."', ": $rq =
"NULL, ";---isset($ret["contact_alias"]) && $ret["contact_alias"] != NULL ?
$rq .= "'".htmlentities($ret["contact_alias"], ENT_QUOTES, "UTF-8")."', ":
$rq .= "NULL, "; isset($ret["contact_autologin_key"]) &&
$ret["contact_autologin_key"] != NULL ? $rq .=
"'".htmlentities($ret["contact_autologin_key"], ENT_QUOTES)."', ": $rq =
"NULL, "; if ($encryptType == 1)
    isset($ret["contact_passwd"]) && $ret["contact_passwd"] != NULL ? $rq .=
    "'".md5($ret["contact_passwd"])."', ": $rq .= "NULL, ";
else if ($encryptType == 2)
    isset($ret["contact_passwd"]) && $ret["contact_passwd"] != NULL ? $rq .=
    "'".sha1($ret["contact_passwd"])."', ": $rq .= "NULL, ";
    isset($ret["contact_passwd"]) && $ret["contact_passwd"] != NULL ? $rq .=
    "'".md5($ret["contact_passwd"])."', ": $rq .= "NULL, ";

The combination of unsalted hashes and Finding 1 allows an attacker to recover passwords for all accounts. The following example illustrates this attack.

The following php code will dump the hashes of all users:

<?php require_once ("/etc/centreon/centreon.conf.php"); require_once "$classdir/centreonDB.class.php"; $p=new CentreonDB(); $r=$p->query("SELECT contact_passwd from"); while ($w=&$r->fetchRow()) {echo $w["contact_passwd"] . "<br>";} ?>

To upload and execute this code on the server, one method is to convert the above php code to hexadecimal and use the remote code execution method outlined in Finding 1 to create a server-side php file. The length of the URL accepted in this case is limited, so the file must be broken into three parts. The following requests create the php file "test.php":




Execution of http://example.domain/centreon/test.php will provide the unsalted hashes. Using rainbow tables, these passwords can be reversed, the time and size of rainbow table required dependent on the complexity of the passwords involved.

Remediation Steps: Customers should upgrade to version 2.3.2 in order to remediate these issues.

Revision History: 10/19/11 - Vulnerability Disclosed 11/02/11 - Patch released 11/04/11 - Advisory Published

References 1. 2.

About Trustwave: Trustwave is the leading provider of on-demand and subscription-based information security and payment card industry compliance management solutions to businesses and government entities throughout the world. For organizations faced with today's challenging data security and compliance environment, Trustwave provides a unique approach with comprehensive solutions that include its flagship TrustKeeper compliance management software and other proprietary security solutions. Trustwave has helped thousands of organizations -- ranging from Fortune 500 businesses and large financial institutions to small and medium-sized retailers--manage compliance and secure their network infrastructure, data communications and critical information assets. Trustwave is headquartered in Chicago with offices throughout North America, South America, Europe, Africa, China and Australia. For more information, visit

About Trustwave's SpiderLabs: SpiderLabs(R) is the advanced security team at Trustwave focused on application security, incident response, penetration testing, physical security and security research. The team has performed over a thousand incident investigations, thousands of penetration tests and hundreds of application security tests globally. In addition, the SpiderLabs Research team provides intelligence through bleeding-edge research and proof of concept tool development to enhance Trustwave's products and services.

Disclaimer: The information provided in this advisory is provided "as is" without warranty of any kind. Trustwave disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. In no event shall Trustwave or its suppliers be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages, even if Trustwave or its suppliers have been advised of the possibility of such damages. Some states do not allow the exclusion or limitation of liability for consequential or incidental damages so the foregoing limitation may not apply.

This transmission may contain information that is privileged, confidential, and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format.