-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
Fix PASSWORD_SPRAY being ignored for LDAP (and potetnially other modules) #19079
Conversation
Setup of LDAP server:
Setup the
Add another user:
Give it this text:
Metasploit test:
|
Thanks for the PR; I don't quite have the cycles to review this fully, but if this is building an in-memory array of permutations before executing things - then that pattern won't scale well for large user/password lists unfortunately That's something I ran into with the older brute force mixin - #15115 - that I believe the |
023083d
to
b7e0e83
Compare
@adfoster-r7 I agree that on large arrays (user count * password count) it can become very big and probably consume a lot of memory, so I reverted the patch and made a "duplicate" of the function with I don't have enough Ruby understanding to make sure it works (my Ruby skills aren't that great at the moment) Also I don't see any unit-tests I can use to verify it works as expected on all scenarios I did check it on FTP and LDAP with username/password files - seems to work as expected |
Hmm - do these work? Or do we need to add more 👀 |
@adfoster-r7 opps, I have no idea how to use these as unittest - any guidance in Metapsloit guides or elsewhere on how to run these as standalone? VS doesn't show them as |
Sorry for the delay; Do these steps work? |
Looks like it will help, I will give it a try |
@adfoster-r7 Should be: |
Is the DB error I am getting for rspec, related to this step:
|
My bad, I misinterpreted the outcome, on
|
On branch
|
Should I add a test for the |
That sounds good to me - thanks! 💯 |
I added a It seems to be related to the inability to open the
|
I have committed the changes as well as the rspec, I think we are ok with integration |
# @yieldparam credential [Metasploit::Framework::Credential] | ||
# @return [void] | ||
def each_unfiltered | ||
# When password spraying is enabled, do first passwords then userames |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# When password spraying is enabled, do first passwords then userames | |
# When password spraying is enabled, do first passwords then usernames |
user_fd.close if user_fd && !user_fd.closed? | ||
end | ||
|
||
# When password spraying is not enabled, do first usersnames then passwords |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# When password spraying is not enabled, do first usersnames then passwords | |
# When password spraying is not enabled, do first usernames then passwords |
Tested against SMB, with the change I suggested above added locally.
|
@cgranleese-r7 I added your suggestions - thank you for the review |
Release NotesFixes an issue were the |
Fixes #18994 which will fix the PASSWORD_SPRAY (unhandling) issue whenever the code is still using
each
for credentials rather than newer functionsI am unable to test it for all modules that use this - I did test it for LDAP