add support for HELO to smtp_relay auxiliary module in case EHLO is not supported #18377
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.
About
This change adds a check to the
smtp_relay auxiliary
scanner module to see if theEHLO
command is actually supported by the server. If not, the module will try to initiate the session using theHELO
command instead.I encountered this scenario during an assessment and while the original module failed to detect open main relay, I was able to correctly identify the server as allowing for open SMTP relay after adding this simple check. I don't know the version info of the server from my scenario, since this info was not included in the banner, but here is the Nmap version scan output:
I'm not sure how common this scenario is, but given that
EHLO
is an enhanced version ofHELO
, it seems likely that it's not a unique case and that some mail servers simply only supportHELO
. Some quick resources:Scenarios
Failure of the original module to detect open SMTP relay due to unsupported
EHLO
command:Successful run of the module after adding support for
HELO
Note about linting
Rubocop flagged 37 issues for this module that can be autocorrected. In order not to add lots of noise to the PR, I have not yet included these autocorrections in the PR. Once this is approved, they can be added by simply running rubocop with -A.