Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow scanner modules to skip hosts on fail_with #14048

Merged
merged 3 commits into from
Aug 27, 2020

Conversation

zeroSteiner
Copy link
Contributor

I'm not sure if this is a bug or simply a feature gap, but either way scanner modules who have a run_host method defined can not utilize the fail_with pattern of exiting out. This is because fail_with raises a Msf::Auxiliary::Failed exception which isn't ignored on a per-host basis. I would think that within run_host we'd want failures to simply cause the processing of that one host to be aborted and not the entire range that the user specified. This would also allow scanner modules to invoke mixin methods that use fail_with without breaking.

I would assume that fail_with instances that should cause the entire module to be aborted (like Failure::BadConfig) would be placed in the top level run method before calling super to invoke the scan logic. I can't seem to find an instance of any scanners doing this though.

I updated the Jupyter Login module as a contrived example to show that if it fails to identify the remote server, it'll fail_with an appropriate reason and the scanner will move on. This behavior came up while working with the contributor on #13906 (see their comment).

Verification

  • Start msfconsole
  • use auxiliary/scanner/http/jupyter_login
  • set RHOSTS to some Class-C
  • Run the module and see multiple failure methods showing that the entire module was not aborted

@cdelafuente-r7 cdelafuente-r7 self-assigned this Aug 27, 2020
Copy link
Contributor

@cdelafuente-r7 cdelafuente-r7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested the new abort logic added to fail_with and it works as expected. I will go ahead and land it. Thanks!

@cdelafuente-r7 cdelafuente-r7 merged commit af06429 into rapid7:master Aug 27, 2020
@cdelafuente-r7
Copy link
Contributor

cdelafuente-r7 commented Aug 27, 2020

Release Notes

Fixed an error handling issue with auxiliary scanners where an entire scan operation would abort when a single scanned host failed with a call to fail_with. This update allows modules to skip hosts and continue on fail_with. Note that this new behavior is optional and can be disabled by using the abort: kwargs.

@pbarry-r7 pbarry-r7 added the rn-fix release notes fix label Sep 3, 2020
@zeroSteiner zeroSteiner deleted the fix/scanner-fail-with branch February 23, 2021 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug library rn-fix release notes fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants