Opalsec

|

Your Trust Doesn’t Matter

Your Trust Doesn't Matter

Non-transitive trusts (a.k.a external trusts) – as described by Microsoft – are designed to “deny trust relationships with other domains”, or in other words, only the two domains involved in the trust will be able to authenticate to each other.

Breaking the Trust

In the diagram below, a non-transitive trust exists between semperisaz.lab and grandchild1.child1.semperis.lab. This allows for a referral TGT – which is used to request Service Tickets for any service within domains with an established trust path – to be requested for grandchild1.child1.semperis.lab.

However because it’s a non-transitive trust – there isn’t a trust path between semperisaz.lab and semperis.lab, and attempting to obtain a referral to this domain fails – as expected.

Your Trust Doesn't Matter
Figure 1: Non-transitive trusts prevent (direct) authentication to disallowed domains.
Your Trust Doesn't Matter
Figure 2: The “local” TGT can then be used to request a referral for the secondary domain.

While this technique stops short of allowing an attacker to perform “trust hopping” into another forest, Semperis points out the implications of even this limited scope.



Pivoting using machine accounts

Semperis have been able to chain this technique with one they previously disclosed, in order to extend the use of local TGTs to enable trust hopping to a forest with which no trusts exist.

Continuing from where the previous scenario left off, the referral TGT for the semperis.lab domain can be used to retrieve a Service Ticket for the LDAP service, which can then be abused to create a machine account in that domain.

Your Trust Doesn't Matter
Figure 3: Creating the TestComp account in semperis.lab

This account essentially serves as a beachhead within the semperis.lab domain from which we can repeat the exploitation of the flaws found in AD non-transitive trusts.

The machine account’s TGT requests a referral to the trusting domain of treetest.lab, which is then used request a “local” TGT from treetest.lab.

Your Trust Doesn't Matter
Figure 4: The machine account retrieves a local TGT for the intermediate domain

This local TGT can then be used to request a referral from the DC of the treetest.lab domain to the dsptest.lab domain – which should have been out-of-bounds of an account in semperis.lab, according to the design intent of non-transitive trusts.

Your Trust Doesn't Matter
Figure 5: The machine account on semperis.lab can now authenticate to Services in the dsptest.lab domain, for which no trust exists.


“It’s not a vulnerability, so – no.”

Unfortunately, Microsoft believe this flaw can’t be classified as a vulnerability, and as such – won’t be taking any action to rectify it.

Your Trust Doesn't Matter
Figure 6: Microsoft’s response to Semeperis’ bug report

Failing that, Semperis recommend auditing Windows 4769 events (A Kerberos service ticket was requested), specifically:

  1. Where a local TGT is requested – the domain (Account Domain field) is for a different forest, and the Service Name is krbtgt;
  2. A second event which follows, requesting a referral TGT – the domain (Account Domain field) is a domain in a different forest, and the Service Name is another domain within the local forest.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *