# AD Trust

AD 트러스트는 서로 다른 도메인/포레스트 간 인증 정보를 신뢰하고 리소스를 공유할 수 있도록 돕는 서비스입니다.&#x20;

## 정보 수집

{% tabs %}
{% tab title="Windows" %}

<pre class="language-powershell"><code class="lang-powershell"><strong># 트러스트 모델 수집
</strong>Get-ADTrust -Filter * | Select-Object Name, Direction
</code></pre>

{% endtab %}

{% tab title="UNIX" %}

<pre class="language-bash"><code class="lang-bash"><strong># 트러스트 모델 수집
</strong>ldapsearch -x -H ldap://192.168.1.9 -D "Attack3r@pentest.local" -w "Password123!" -b "dc=pentest,dc=local" "(objectClass=trustedDomain)" name trustType TrustDirection
</code></pre>

{% endtab %}
{% endtabs %}

## 트러스트 모델

<figure><img src="/files/jpUHwQySL4B8JIY5nJYm" alt=""><figcaption></figcaption></figure>

<table><thead><tr><th width="166">모델</th><th>관계</th></tr></thead><tbody><tr><td>Forest trust</td><td>서로 다른 포레스트의 루트 트리 간에 이어지며 해당 루트 트리 하위 간에는 전이적 신뢰 관계</td></tr><tr><td>Root Tree Trust</td><td>같은 포레스트 내 다른 트리 루트 간 전이적 신뢰 관계</td></tr><tr><td>Parent/Child Trust</td><td>기존 상위 도메인 하위에 새로운 도메인이 조인될 경우 자동으로 부모/자식 관계가 맺어지는 양방향 전이적 신뢰 관계</td></tr><tr><td>External Trust</td><td>서로 다른 포레스트 내부 도메인 간의 비전이적 신뢰 관계</td></tr><tr><td>Shortcut Trust</td><td>커버로스 인증 경로를 단축하기 위한 포레스트 내부 도메인 간의 전이적 신뢰 관계</td></tr></tbody></table>

## 커버로스 인증 체계

외부 도메인에 대한 리소스 접근 시, 커버로스 8단계 인증을 거쳐야 합니다.

<figure><img src="/files/vWU40t5xmXt8lgecAK1j" alt="" width="563"><figcaption><p><a href="https://adsecurity.org/?p=1588">https://adsecurity.org/?p=1588</a></p></figcaption></figure>

1. 사용자는 도메인에 인증하여 TGT 발급 요청(AS-REQ)
2. KDC는 사용자의 자격 증명을 확인 후 TGT 발급(AS-REP)
3. 사용자는 외부 도메인 서비스에 대한 서비스 티켓을 요청(TGS-REQ)
4. KDC는 요청한 서비스가 외부 도메인임을 인지하고 레퍼럴 티켓 발급(TGS-REP)
5. 사용자는 레퍼럴 티켓을 통해 외부 도메인 KDC에 서비스 티켓 요청
6. 외부 도메인은 레퍼럴 티켓을 복호화하여 확인 후 서비스 티켓 발급
7. 사용자는 외부 서비스 이용

내부 도메인에 대한 TGS-REQ에서는 realm 필드를 내부 도메인으로 지정하되 sname-string 필드는 외부 SPN으로 지정합니다. 만약 외부 도메인이 같은 포레스트 내에 존재한다면 클라이언트가 요청한 sname-string이 실제로 유효한지 검증하고, 포레스트 외부에 존재한다면 트러스트 관계의 이름 접미사만 같다면 레퍼럴 티켓을 발급합니다.

<div><figure><img src="/files/E8D6MbMABMNnzwy1NPGs" alt=""><figcaption><p>TGS-REQ(내부 도메인)</p></figcaption></figure> <figure><img src="/files/rCEYOQXG9ObFoo2M7gB2" alt=""><figcaption><p>TGS-REP(내부 도메인)</p></figcaption></figure></div>

발급된 티켓을 가지고 외부 도메인에 서비스 티켓을 요청합니다. 이때는 처음 sname-string 필드에 명시했던 외부 도메인의 SPN을 기입하여 최종적으로 서비스에 대한 접근권을 획득합니다.

<div><figure><img src="/files/HA7aWdXKXoW52uRJHrBB" alt=""><figcaption><p>TGS-REQ(외부 도메인)</p></figcaption></figure> <figure><img src="/files/neQb5G0fvQWFQyzhl1nk" alt=""><figcaption><p>TGS-REP(외부 도메인)</p></figcaption></figure></div>

## References

{% embed url="<https://zindagitech.com/different-types-of-trusts-in-an-active-directory/>" %}

{% embed url="<https://harmj0y.medium.com/a-guide-to-attacking-domain-trusts-ef5f8992bb9d>" %}

{% embed url="<https://www.windows-active-directory.com/active-directory-trusts.html>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.pentestwiki.com/active-directory/ad-trust.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
