Module: Msf::Auxiliary::EPMP

Includes:
AuthBrute, Report, Scanner, Exploit::Remote::HttpClient
Defined in:
lib/msf/core/auxiliary/epmp.rb

Overview

This module provides methods for working with epmp

Instance Attribute Summary

Attributes included from Exploit::Remote::HttpClient

#client

Instance Method Summary collapse

Methods included from Scanner

#add_delay_jitter, #check, #has_check?, #has_fatal_errors?, #initialize, #peer, #run, #scanner_handle_fatal_errors, #scanner_progress, #scanner_show_progress, #seppuko!

Methods included from Report

#active_db?, #create_cracked_credential, #create_credential, #create_credential_and_login, #create_credential_login, #db, #db_warning_given?, #get_client, #get_host, #inside_workspace_boundary?, #invalidate_login, #mytask, #myworkspace, #myworkspace_id, #report_auth_info, #report_client, #report_exploit, #report_host, #report_loot, #report_note, #report_service, #report_vuln, #report_web_form, #report_web_page, #report_web_site, #report_web_vuln, #store_cred, #store_local, #store_loot

Methods included from Metasploit::Framework::Require

optionally, optionally_active_record_railtie, optionally_include_metasploit_credential_creation, #optionally_include_metasploit_credential_creation, optionally_require_metasploit_db_gem_engines

Methods included from AuthBrute

#adjust_credentials_by_max_user, #build_brute_message, #build_credentials_array, #cleanup_files, #combine_users_and_passwords, #counters_expired?, #each_ntlm_cred, #each_password_cred, #each_ssh_cred, #each_user_pass, #each_username_cred, #extract_word_pair, #extract_word_pair_from_memory, #extract_words, #gen_blank_passwords, #gen_user_as_password, #get_object_from_memory_location, #initialize, #initialize_class_variables, #just_uniq_passwords, #just_uniq_users, #load_password_vars, #load_user_vars, #prepend_chosen_password, #prepend_chosen_username, #prepend_db_creds?, #prepend_db_hashes, #prepend_db_keys, #prepend_db_passwords, #prepend_db_usernames, #print_brute, #process_cred_for_collection, #proto_from_fullname, #setup, #translate_proto_datastores, #tried_over_total, #userpass_interval, #userpass_sleep_interval, #vprint_brute, #vprint_error, #vprint_good, #vprint_status

Methods included from Exploit::Remote::HttpClient

#basic_auth, #cleanup, #configure_http_login_scanner, #connect, #deregister_http_client_options, #disconnect, #download, #full_uri, #handler, #http_fingerprint, #initialize, #lookup_http_fingerprints, #normalize_uri, #path_from_uri, #peer, #proxies, #reconfig_redirect_opts!, #request_opts_from_url, #request_url, #rhost, #rport, #send_request_cgi, #send_request_cgi!, #send_request_raw, #service_details, #setup, #ssl, #ssl_version, #strip_tags, #target_uri, #validate_fingerprint, #vhost

Instance Method Details

#is_app_epmp1000?Boolean

Check if App is Cambium ePMP 1000

Returns:

  • (Boolean)

46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/msf/core/auxiliary/epmp.rb', line 46

def is_app_epmp1000?
  begin
    res = send_request_cgi(
      {
        'uri'       => '/',
        'method'    => 'GET'
      }
    )
  rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionError
    print_error("#{rhost}:#{rport} - HTTP Connection Failed...")
    return false
  end

  good_response = (
    res &&
    res.code == 200 &&
    (res.body.include?('cambium.min.css') || res.body.include?('cambiumnetworks.com') && res.body.include?('https://support.cambiumnetworks.com/files/epmp/'))
  )

  if good_response
    get_epmp_ver = res.body.match(/"sw_version">([^<]*)/)
    if !get_epmp_ver.nil?
      epmp_ver = get_epmp_ver[1]
      if !epmp_ver.nil?
        print_good("#{rhost}:#{rport} - Running Cambium ePMP 1000 version #{epmp_ver}...")
        (epmp_ver.to_s)
        return true
      else
        print_good("#{rhost}:#{rport} - Running Cambium ePMP 1000...")
        epmp_ver = ''
        (datastore['USERNAME'], datastore['PASSWORD'], epmp_ver)
        return true
      end
    end
  else
    print_error("#{rhost}:#{rport} - Application does not appear to be Cambium ePMP 1000. Module will not continue.")
    return false
  end
end

#login_1(user, pass, epmp_ver) ⇒ Object

run if version < 3.4.1


191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
# File 'lib/msf/core/auxiliary/epmp.rb', line 191

def (user, pass, epmp_ver)
  res = send_request_cgi(
    {
      'uri' => '/cgi-bin/luci',
      'method' => 'POST',
      'headers' => {
        'X-Requested-With' => 'XMLHttpRequest',
        'Accept' => 'application/json, text/javascript, */*; q=0.01'
      },
      'vars_post' =>
        {
          'username' => 'dashboard',
          'password' => ''
        }
    }
  )

  cookies = res.get_cookies_parsed
  check_sysauth = cookies.values.select { |v| v.to_s =~ /sysauth_/ }.first.to_s

  good_response = (
    res &&
    res.code == 200 &&
    check_sysauth.include?('sysauth')
  )

  if good_response
    sysauth_dirty = cookies.values.select { |v| v.to_s =~ /sysauth_/ }.first.to_s
    sysauth_value = sysauth_dirty.match(/((.*)[$ ])/)

    cookie1 = "#{sysauth_value}" + "globalParams=%7B%22dashboard%22%3A%7B%22refresh_rate%22%3A%225%22%7D%2C%22#{user}%22%3A%7B%22refresh_rate%22%3A%225%22%7D%7D"

    res = send_request_cgi(
      {
        'uri' => '/cgi-bin/luci',
        'method' => 'POST',
        'cookie' => cookie1,
        'headers' => {
          'X-Requested-With' => 'XMLHttpRequest',
          'Accept' => 'application/json, text/javascript, */*; q=0.01',
          'Connection' => 'close'
        },
        'vars_post' =>
          {
            'username' => user,
            'password' => pass
          }
      }
    )

    cookies = res.get_cookies_parsed

    good_response = (
      res &&
      res.code == 200 &&
      !res.body.include?('auth_failed')
    )

    if good_response
      print_good("SUCCESSFUL LOGIN - #{rhost}:#{rport} - #{user.inspect}:#{pass.inspect}")
      report_cred(
        ip: rhost,
        port: rport,
        service_name: "Cambium ePMP 1000 version #{epmp_ver}",
        user: user,
        password: pass
      )

      # check if max_user_number_reached?
      if !res.body.include?('max_user_number_reached')
      # get the final cookie now
        cookies = res.get_cookies_parsed
        stok_value = cookies.has_key?('stok') && cookies['stok'].first
        sysauth_dirty = cookies.values.select { |v| v.to_s =~ /sysauth_/ }.first.to_s
        sysauth_value = sysauth_dirty.match(/((.*)[$ ])/)

        final_cookie = "#{sysauth_value}" + "globalParams=%7B%22dashboard%22%3A%7B%22refresh_rate%22%3A%225%22%7D%2C%22#{user}%22%3A%7B%22refresh_rate%22%3A%225%22%7D%7D; userType=Installer; usernameType=installer; stok=" + stok_value

        # create config_uri for different modules
        config_uri_dump_config = '/cgi-bin/luci/;stok=' + stok_value + '/admin/config_export?opts=json'
        config_uri_reset_pass = '/cgi-bin/luci/;stok=' + stok_value + '/admin/set_param'
        config_uri_get_chart = '/cgi-bin/luci/;stok=' + stok_value + '/admin/get_chart'
        config_uri_ping = '/cgi-bin/luci/;stok=' + stok_value + '/admin/ping'

        return final_cookie, config_uri_dump_config, config_uri_reset_pass, config_uri_get_chart, config_uri_ping
      else
        print_error('The credentials are correct but maximum number of logged-in users reached. Try again later.')
        final_cookie = 'skip'
        config_uri_dump_config = 'skip'
        config_uri_reset_pass = 'skip'
        config_uri_get_chart = 'skip'
        config_uri_ping = 'skip'
        return final_cookie, config_uri_dump_config, config_uri_reset_pass, config_uri_get_chart, config_uri_ping
      end
    else
      print_error("FAILED LOGIN - #{rhost}:#{rport} - #{user.inspect}:#{pass.inspect}")
      final_cookie = 'skip'
      config_uri_dump_config = 'skip'
      config_uri_reset_pass = 'skip'
      config_uri_get_chart = 'skip'
      config_uri_ping = 'skip'
      return final_cookie, config_uri_dump_config, config_uri_reset_pass, config_uri_get_chart, config_uri_ping
    end
  end
end

#login_2(user, pass, epmp_ver) ⇒ Object

run if version > 3.4.1


88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/msf/core/auxiliary/epmp.rb', line 88

def (user, pass, epmp_ver)
  res = send_request_cgi(
    {
      'uri' => '/cgi-bin/luci',
      'method' => 'POST',
      'headers' => {
        'X-Requested-With' => 'XMLHttpRequest',
        'Accept' => 'application/json, text/javascript, */*; q=0.01'
      },
      'vars_post' =>
        {
          'username' => 'dashboard',
          'password' => ''
        }
    }
  )

  cookies = res.get_cookies_parsed
  check_sysauth = cookies.values.select { |v| v.to_s =~ /sysauth_/ }.first.to_s

  good_response = (
    res &&
    res.code == 200 &&
    check_sysauth.include?('sysauth')
  )

  if good_response
    sysauth_dirty = cookies.values.select { |v| v.to_s =~ /sysauth_/ }.first.to_s
    sysauth_value = sysauth_dirty.match(/((.*)[$ ])/)
    prevsessid = res.body.match(/((?:[a-z][a-z]*[0-9]+[a-z0-9]*))/)

    res = send_request_cgi(
      {
        'uri' => '/cgi-bin/luci',
        'method' => 'POST',
        'cookie' => sysauth_value,
        'headers' => {
          'X-Requested-With' => 'XMLHttpRequest',
          'Accept' => 'application/json, text/javascript, */*; q=0.01',
          'Connection' => 'close'
        },
        'vars_post' =>
          {
            'username' => user,
            'password' => pass,
            'prevsess' => prevsessid
          }
      }
    )

    good_response = (
      res &&
      res.code == 200 &&
      !res.body.include?('auth_failed')
    )

    if good_response
      print_good("SUCCESSFUL LOGIN - #{rhost}:#{rport} - #{user.inspect}:#{pass.inspect}")
      report_cred(
        ip: rhost,
        port: rport,
        service_name: "Cambium ePMP 1000 version #{epmp_ver}",
        user: user,
        password: pass
      )

      # check if max_user_number_reached?
      if !res.body.include?('max_user_number_reached')
        # get the cookie now
        cookies = res.get_cookies_parsed
        stok_value_dirty = res.body.match(/"stok": "(.*?)"/)
        stok_value = "#{stok_value_dirty}".split('"')[3]
        sysauth_dirty = cookies.values.select { |v| v.to_s =~ /sysauth_/ }.first.to_s
        sysauth_value = sysauth_dirty.match(/((.*)[$ ])/)

        final_cookie = "#{sysauth_value}" + 'usernameType_80=admin; stok_80=' + stok_value

        # create config_uri for different modules
        config_uri_dump_config = '/cgi-bin/luci/;stok=' + stok_value + '/admin/config_export?opts=json'
        config_uri_reset_pass = '/cgi-bin/luci/;stok=' + stok_value + '/admin/set_param'
        config_uri_get_chart = '/cgi-bin/luci/;stok=' + stok_value + '/admin/get_chart'

        return final_cookie, config_uri_dump_config, config_uri_reset_pass, config_uri_get_chart
      else
        print_error('The credentials are correct but maximum number of logged-in users reached. Try again later.')
        final_cookie = 'skip'
        config_uri_dump_config = 'skip'
        config_uri_reset_pass = 'skip'
        config_uri_get_chart = 'skip'
        return final_cookie, config_uri_dump_config, config_uri_reset_pass, config_uri_get_chart
      end
    else
      print_error("FAILED LOGIN - #{rhost}:#{rport} - #{user.inspect}:#{pass.inspect}")
      final_cookie = 'skip'
      config_uri_dump_config = 'skip'
      config_uri_reset_pass = 'skip'
      config_uri_get_chart = 'skip'
      return final_cookie, config_uri_dump_config, config_uri_reset_pass, config_uri_get_chart
    end
  end
end

#report_cred(opts) ⇒ Object


15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/msf/core/auxiliary/epmp.rb', line 15

def report_cred(opts)
  service_data = {
    address: opts[:ip],
    port: opts[:port],
    service_name: opts[:service_name],
    protocol: 'tcp',
    workspace_id: myworkspace_id
  }

  credential_data = {
    origin_type: :service,
    module_fullname: fullname,
    username: opts[:user],
    private_data: opts[:password],
    private_type: :password
  }.merge(service_data)

   = {
    last_attempted_at: Time.now,
    core: create_credential(credential_data),
    status: Metasploit::Model::Login::Status::SUCCESSFUL,
    proof: opts[:proof]
  }.merge(service_data)

  ()
end