Kerberos Constrained Delegation is a feature in Kerberos authentication protocol that allows a service to impersonate a client and access other services on behalf of that client. It provides a way to delegate a user's credentials to a service so that the service can authenticate and access resources on behalf of the user. This feature is used to enable scenarios like multi-tier applications, where a front-end service needs to access back-end services on behalf of the user.

Constrained delegation adds an extra layer of security by limiting the services that a service can impersonate and the target services that it can access. This helps prevent unauthorized access and reduces the attack surface.

By using Kerberos Constrained Delegation, organizations can achieve a balance between security and functionality, allowing services to perform delegated tasks while still maintaining control over the scope of the delegation.

The three types of Kerberos Constrained Delegation are:

  1. Service-for-User-to-Self (S4U2Self): This allows a service to obtain a ticket to itself on behalf of a user.
  2. Service-for-User-to-Proxy (S4U2Proxy): This allows a service to obtain a ticket to another service on behalf of a user.
  3. Resource-based Constrained Delegation: This allows the resource owner to control which services can delegate to the resource.

Constrained Delegation Attack and find the flag

To illustrate a constrained delegation attack, we'll make the assumption that the web_service user, which is trusted for delegation, has been compromised. The password for this account is 'Slavi123'. We'll kick off the process by employing the 'Get-NetUser' function from PowerView to list user accounts in the domain that are trusted for constrained delegation.

PS C:\Users\bob\Downloads> Get-NetUser -TrustedToAuth

Screenshot 2024-02-29 at 16.34.06.png

It seems that the web-service delegates the HTTP to DC1. Therefore, any threat actor gaining control over web_service can request a Kerberos ticket for any user in Active Directory and use it to connect to DC1 over PowerShell Remoting.

Screenshot 2024-02-29 at 16.38.15.png

When im trying to attempt getting a ticket, it says that i must impersonate as a /tgs

Screenshot 2024-02-29 at 16.41.23.png

therefore im trying to impersonate as admin first

Screenshot 2024-02-29 at 16.48.47.png