Rpc creds reports domain#21285
Conversation
|
Thanks for your pull request! As part of our landing process, we manually verify that all modules work as expected. We've added the |
|
ICPR errors in tests: don't think they're related, might be wrong. |
There was a problem hiding this comment.
Pull request overview
This PR updates LDAP and SMB login scanners to persist the provided domain as a credential “realm”, and exposes that realm information via the db.creds RPC endpoint.
Changes:
- SMB login credential reporting now includes
realm_key/realm_valuewhen a domain/realm is present. - LDAP login now uses
LDAPDomainconsistently for credential realm and sets the realm key when a domain is provided. rpc.call('db.creds', ...)responses now includerealm_keyandrealm_valuefields.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| modules/auxiliary/scanner/smb/smb_login.rb | Persist SMB credential realm (domain) into reported credentials. |
| modules/auxiliary/scanner/ldap/ldap_login.rb | Use LDAPDomain as the credential realm and set realm key when present. |
| lib/msf/core/rpc/v10/rpc_db.rb | Add realm fields to the db.creds RPC response. |
15280ea to
495385f
Compare
| :proto => proto, | ||
| :sname => sname | ||
| :sname => sname, | ||
| :realm_key => cred.realm.try(:key), |
There was a problem hiding this comment.
What are your thoughts on:
realm = cred.realm ? { key: cred.realm.key, value: cred.realm.value } : nil
...
ret[:creds] << {
...,
:realm => realm
}There was a problem hiding this comment.
This approach is consistent with the rpc_create_credential method here:
I can change it though if we'd prefer 👍
| } | ||
|
|
||
| realm_key = nil | ||
| realm_key = datastore['LDAPDomain'].present? ? Metasploit::Model::Realm::Key::ACTIVE_DIRECTORY_DOMAIN : nil |
There was a problem hiding this comment.
I think we want this change reverted. This is a side by side comparison of the new behavior on the left and the old behavior on the right.
We can see that the Server 2019 domain controller authentications with NTLM and AUTO (which is NTLM IIRC) but not plaintext. In both cases, it logs the incorrect domain, when it should be either MSFLAB or msflab.local. The old behavior leaves the domain blank which is probably better than logging an incorrect value.
495385f to
b91d6a5
Compare
Closes #21241
The rpc creds command now returns the credential's realm key and value.
Before
=> missing domain
After
Verification
You can load the RPC plugin in msfconsole using
load msgrpc.Connect to RPC by calling
bundle exec ./msfrpc -- -U msf -P PASSWORD_HERE -a 127.0.0.1 -S -p 55552msfconsoleload msgrpccredsoutputs the domain: