In an AD environment, once an operator obtains a certificate with an EKU enabled that allows some kind of Client Authentication, the logical and usual next step is to initialize an AS Exchange via PKINIT Certificate Trust in order to obtain a Ticket Granting Ticket ( TGT ) as the principal ( User or Computer Account ) for which the certificate in question has been issued, which usually appears in the certificate subject ( SID, SAN, UPN and so on )
However, this approach is not always feasible, usually because the DC’s Certificate does not have the Smart Card Logon EKU, which is an essential requirement for the DC to support PKINIT
Therefore, if we perform PtC to obtain a TGT through PKINIT against a DC whose certificate does not have the mentioned EKU, we will receive the following error
KDC_ERR_PADATA_TYPE_NOSUPP
And here comes to play Schannel, which is the Miscrosoft SSL/TLS implementation on Windows and supports both client and server authentication
Thus, we can leverage the issued certificate to authenticate ourselves against LDAPS or LDAP ( STARTTLS enabled ) and perform certain actions such as →
Add, Rename or Delete a Computer Account
Leveraging the Domain MAQ ( Machine Account Quota )
Perform LDAP Queries
Computer Account Certificate → RBCD
Populate and clear its msDS-AllowedToActOnBehalfOfOtherIdentities
Grant DCSync Rights
This technique is basically an alternative to PKINIT
Abuse - UNIX-Like
Workflow
Let’s suppose that we already have a certificate related to domain computer account which has the Client Authentication Extended Key Usage ( EKU ) enabled, but the DC does not support PKINIT authentication, so we cannot neither retrieve a valid TGT related to the computer account nor perform UnPac the Hash to extract the NT hash from the TGT’s PAC
In this situation, we can leverage Schannel to authenticate ourselves against the DC’s LDAP server, either using LDAPs or LDAP with STARTTLS enabled
As we are acting on behalf of the given domain computer account and, by default, any domain computer account has WriteProperty right on its own ms-DS-AllowedToActOnBehalfOfOtherIdentity attribute, we can carry out a RBCD
Before modifying the aforementioned attribute, we have to leverage the ms-DS-MachineAccountQuota domain attribute in order to add a computer account to the domain, as we need a domain service account under our control to be able to carry out a Full S4U ( i.e. S4U2Self + S4U2Proxy ) and request a Service Ticket as any user to authenticate to a specific service of the computer account victim
To do so, we need a valid domain user account, which we have compromised previously
So, the steps would be as follows
Add a new computer account to the domain
Enable RBCD on the target computer account through LDAPs Authentication via Schannel
Request a Service Ticket for an specific target computer account’s service by carrying out a Full S4U
Pass the Ticket to compromise the domain-joined machine related to the computer account