Skip to content

Improve kerberos user enum module - #16430

Merged
dwelch-r7 merged 2 commits into
rapid7:masterfrom
adfoster-r7:improve-kerberos-user-enum-module
May 13, 2022
Merged

Improve kerberos user enum module#16430
dwelch-r7 merged 2 commits into
rapid7:masterfrom
adfoster-r7:improve-kerberos-user-enum-module

Conversation

@adfoster-r7

@adfoster-r7 adfoster-r7 commented Apr 8, 2022

Copy link
Copy Markdown
Contributor

Closes #15286

Adds support for logging AS-REP Roastable accounts, as well as storing the generated Kerberos token within the creds database. Additionally improves error handling.

These accounts can be shown by toggling the following flag after creating a new user within a domain controller:
image

Verification

  • Follow the scenario steps within the documentation
  • Optional: Verify modules/auxiliary/admin/kerberos/ms14_068_kerberos_checksum works as expected

@adfoster-r7 adfoster-r7 added the rn-enhancement release notes enhancement label Apr 8, 2022
def user_list
users = nil
if File.readable? datastore['USER_FILE']
users = File.new(datastore['USER_FILE']).read.split

@adfoster-r7 adfoster-r7 Apr 8, 2022

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

User accounts with spaces weren't being handled correctly, I've changed this to readlines now

Long term this should be using the brute force mixin for running enumeration in parallel, but that's out of scope for this PR

@adfoster-r7
adfoster-r7 force-pushed the improve-kerberos-user-enum-module branch from 1ab9da5 to a53be31 Compare April 8, 2022 19:48
hashcat -m 18200 -a 0 ./hashes.txt ./wordlist.txt
```

You can see previously creds with:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
You can see previously creds with:
You can see previously stored creds with:

credential_data.merge!(
private_data: opts[:asrep],
private_type: :nonreplayable_hash,
jtr_format: 'krb5'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I went with krb5 for now, which is validated here:
https://github.com/rapid7/metasploit-credential/blob/1d2b701e5aa3ca316dc7068cf5b98849fc4349cd/app/models/metasploit/credential/nonreplayable_hash.rb#L10-L23

But I believe the john format list has been updated since 2014, and there's more granularity available now:

➜  ~ john --list=formats
... krb5, krb5asrep, krb5pa-sha1, krb5tgs, krb5-17, krb5-18, krb5-3, krb5pa-md5,  ...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Pull request to add the newer formats rapid7/metasploit-credential#162

@dwelch-r7

Copy link
Copy Markdown
Contributor

Testd all the scenarios and looks good to me will land

@dwelch-r7
dwelch-r7 merged commit c0c02e5 into rapid7:master May 13, 2022
@dwelch-r7

Copy link
Copy Markdown
Contributor

Release Notes

Adds support for logging AS-REP Roastable accounts, as well as storing the generated Kerberos token within the creds database. Additionally improves error handling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rn-enhancement release notes enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Module auxiliary/gather/kerberos_enumusers errors when enumerating users with no preauthentication required

4 participants