Register VulnAttempts for both Exploit and Auxiliary modules #20263
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In continuation to the
ExploitAttempt
PR, this one enables auxiliary modules to properly register as aVulnAttempt
. Due to the nature of auxiliary modules, it is not guaranteed the module properly reports a failure or a success. In fact, most of the auxiliary modules don’t callfail_with
, but just returnnil
. Also, scanner/gather modules that get no results also won’t report this attempt as a failure. For all of these reasons, the resultingVulnAttempt
for auxiliary modules will have afail_reason
with the valuenone
when the actual result is unknown.Verification
Register a vulnerability using an exploit and an auxiliary modules
This will require a Windows target and admin credentials.
msfconsole
workspace -a vuln_attempt_test
vulns
andhosts
commandsuse exploit/windows/smb/psexec
run verbose=true rhosts=<remote host> smbuser=<username> smbpass=<password>
vulns
andhosts
commandspry
commandMdm::Host.where(workspace: Mdm::Workspace.where(name: 'vuln_attempt_test').first).first.vulns.first.id
Mdm::VulnAttempt
data model with this command:Mdm::VulnAttempt.where(vuln_id: <vuln ID>)
use auxiliary/admin/smb/psexec_ntdsgrab
).Scenarios