Skip to content

Commit 0876302

Browse files
committed
Merge pull request rapid7#3580 from dmaloney-r7/bug/MSP-10869/credential-parent
Credential Parent References
2 parents 7a49f21 + 78a3263 commit 0876302

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

lib/metasploit/framework/credential.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ class Credential
1212
# @return [Boolean] Whether BOTH a public and private are required
1313
# (defaults to `true`)
1414
attr_accessor :paired
15+
# @!attribute parent
16+
# @return [Object] the parent object that had .to_credential called on it to create this object
17+
attr_accessor :parent
1518
# @!attribute private
1619
# The private credential component (e.g. username)
1720
#

lib/metasploit/framework/login_scanner/base.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ def each_credential
8383
# This could be a Credential object, or a Credential Core, or an Attempt object
8484
# so make sure that whatever it is, we end up with a Credential.
8585
credential = raw_cred.to_credential
86+
credential.parent = raw_cred
8687

8788
if credential.realm.present? && self.class::REALM_KEY.present?
8889
credential.realm_key = self.class::REALM_KEY
@@ -129,7 +130,14 @@ def scan!
129130
successful_users = Set.new
130131

131132
each_credential do |credential|
132-
next if successful_users.include?(credential.public)
133+
# For Pro bruteforce Reuse and Guess we need to note that we skipped an attempt.
134+
if successful_users.include?(credential.public)
135+
if credential.parent.respond_to?(:skipped)
136+
credential.parent.skipped = true
137+
credential.parent.save!
138+
end
139+
next
140+
end
133141

134142
result = attempt_login(credential)
135143
result.freeze

0 commit comments

Comments
 (0)