Skip to content

Commit d69bfd5

Browse files
committed
store the credential using the new store_valid_credential
1 parent 4f9117f commit d69bfd5

File tree

2 files changed

+9
-33
lines changed

2 files changed

+9
-33
lines changed

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

Lines changed: 8 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -16,39 +16,14 @@ def wordpress_login(user, pass, timeout = 20)
1616
}, timeout)
1717
if res && res.redirect? && res.redirection && res.redirection.to_s == redirect
1818
cookies = res.get_cookies
19-
end
20-
21-
if cookies && (
22-
# current Wordpress (2.6+)
23-
cookies =~ /wordpress_(?:sec|logged_in_)[^=]+=[^;]+;/i ||
24-
# Wordpress 2.5
25-
cookies =~ /wordpress_[a-z0-9]+=[^;]+;/i ||
26-
# Wordpress 2.0
27-
cookies =~ /wordpress(?:user|pass)_[^=]+=[^;]+;/i
28-
)
29-
30-
service_data = {
31-
address: rhost,
32-
port: rport,
33-
protocol: 'tcp',
34-
service_name: 'http',
35-
workspace_id: myworkspace_id,
36-
}
37-
38-
cdata = {
39-
module_fullname: self.fullname,
40-
origin_type: :service,
41-
username: user,
42-
private_data: pass,
43-
private_type: :password,
44-
}.merge(service_data)
45-
46-
core = create_credential(cdata)
47-
login_data = { core: core }.merge(service_data)
48-
49-
create_credential_login(login_data)
50-
51-
return cookies
19+
# Check if a valid wordpress cookie is returned
20+
return cookies if
21+
# current Wordpress
22+
cookies =~ /wordpress(?:_sec)?_logged_in_[^=]+=[^;]+;/i ||
23+
# Wordpress 2.0
24+
cookies =~ /wordpress(?:user|pass)_[^=]+=[^;]+;/i ||
25+
# Wordpress 2.5
26+
cookies =~ /wordpress_[a-z0-9]+=[^;]+;/i
5227
end
5328

5429
nil

modules/exploits/unix/webapp/wp_admin_shell_upload.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def initialize(info = {})
4343
def check
4444
cookie = wordpress_login(username, password)
4545
if cookie.nil?
46+
store_valid_credential(user: username, private: password, proof: cookie)
4647
return CheckCode::Safe
4748
end
4849

0 commit comments

Comments
 (0)