Skip to content

Commit 4f9117f

Browse files
committed
Reinstate redirect check, fix regex
1 parent 47e5f90 commit 4f9117f

File tree

1 file changed

+6
-4
lines changed
  • lib/msf/core/exploit/http/wordpress

1 file changed

+6
-4
lines changed

lib/msf/core/exploit/http/wordpress/login.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@ def wordpress_login(user, pass, timeout = 20)
1414
'uri' => wordpress_url_login,
1515
'vars_post' => wordpress_helper_login_post_data(user, pass, redirect)
1616
}, timeout)
17-
cookies = res.get_cookies
17+
if res && res.redirect? && res.redirection && res.redirection.to_s == redirect
18+
cookies = res.get_cookies
19+
end
1820

1921
if cookies && (
2022
# current Wordpress (2.6+)
2123
cookies =~ /wordpress_(?:sec|logged_in_)[^=]+=[^;]+;/i ||
2224
# Wordpress 2.5
23-
cookies =~ /wordpress_[a-f0-9]+=[^;]+;/i ||
25+
cookies =~ /wordpress_[a-z0-9]+=[^;]+;/i ||
2426
# Wordpress 2.0
2527
cookies =~ /wordpress(?:user|pass)_[^=]+=[^;]+;/i
2628
)
@@ -30,7 +32,7 @@ def wordpress_login(user, pass, timeout = 20)
3032
port: rport,
3133
protocol: 'tcp',
3234
service_name: 'http',
33-
workspace_id: myworkspace.id,
35+
workspace_id: myworkspace_id,
3436
}
3537

3638
cdata = {
@@ -45,10 +47,10 @@ def wordpress_login(user, pass, timeout = 20)
4547
login_data = { core: core }.merge(service_data)
4648

4749
create_credential_login(login_data)
50+
4851
return cookies
4952
end
5053

51-
5254
nil
5355
end
5456
end

0 commit comments

Comments
 (0)