Introduction to Windows Password Hashes - NTLM Hash and Net-NTLM Hash

Onedaysec
6 min read
7 views
docx image 1770016723908 0 f7bbd14bd2

0x00 Preface

---

In Windows systems, the most common type is the NTLM hash exported from the system, which can be cracked to obtain plaintext passwords using Hashcat.

Hashcat supports over 200 highly optimized hash algorithms, among which four are related to NTLM hash: NetNTLMv1, NetNTLMv1+ESS, NetNTLMv2, and NTLM.

What exactly is NetNTLM? And how is it obtained? Inspired by byt3bl33d3r's article, this article will introduce this topic based on personal insights.

Reference link:

https://byt3bl33d3r.github.io/practical-guide-to-ntlm-relaying-in-2017-aka-getting-a-foothold-in-under-5-minutes.html

0x01 Introduction

---

  • Differences between NTLM hash and Net-NTLM hash
  • Encryption method of NTLM hash
  • Cracking Net-NTLM hash

0x02 NTLM hash

---

Typically refers to the user password hash stored in the Security Account Manager under Windows systems

The generation method of this hash:

  1. Convert the plaintext password into hexadecimal format
  2. Convert to Unicode format, i.e., add 0x00 after each byte
  3. Perform MD4 encryption on the Unicode string to generate a 32-bit hexadecimal string

Practical test:

User password is test123

Converted to hexadecimal format as 74657374313233

Converted to Unicode format as 7400650073007400310032003300

Perform MD4 encryption on the string 7400650073007400310032003300, result is c5a237b7e9d8e708d8436b6148a25fa1

Note:

MD4 encryption can be performed using the tool HashCalc, as shown in the figure below

0x02 NTLM hash — technical illustration 1

Below, use mimikatz to export the user password hash for comparison and verification, results are the same, verification successful, as shown in the figure below

0x02 NTLM hash — technical illustration 2

In penetration testing, all user hashes can typically be obtained from the SAM file in Windows systems and the NTDS.dit file on domain controllers. Reading the lsass.exe process with Mimikatz can retrieve the NTLM hash of logged-in users.

Supplement:

Systems prior to Windows Vista and Windows Server 2008 also used LM hash.

The generation method of LM hash is not covered in this article.

Starting with Windows Vista and Windows Server 2008, Windows discontinued LM hash.

However, some tools require parameters in the fixed format LM hash:NT hash. You can fill the LM hash with 0 (LM hash can be any value), i.e., 00000000000000000000000000000000:NT hash.

0x03 Net-NTLM hash

---

Usually refers to the hash in NTLM authentication in network environments.

NTLM authentication uses a challenge/response message exchange pattern, with the following process:

  1. The client sends a request to the server containing the plaintext login username. The server stores the login username and corresponding password hash in advance.
  2. Upon receiving the request, the server generates a 16-bit random number (called Challenge) and sends it back to the client in plaintext. It encrypts the Challenge using the stored login user password hash to obtain Challenge1.
  3. After receiving the Challenge, the client encrypts it using the login user's password hash to obtain Challenge2 (this result is called response) and sends the response to the server.
  4. The server receives the encrypted response from the client, compares Challenge1 and the response, and if they match, authentication succeeds.

In the above process, the login user's password hash is the NTLM hash, and the response contains the Net-NTLM hash.

For more information on NTLM authentication, refer to:

http://davenport.sourceforge.net/ntlm.html

In NTLM authentication, NTLM responses are categorized into three protocols: NTLM v1, NTLMv2, and NTLM session v2. Different protocols use different formats of Challenge and encryption algorithms.

Thus, there exist Net-NTLM hashes for different protocols, namely Net-NTLM v1 hash and Net-NTLM v2 hash.

Practical test:

Server:

  • IP: 192.168.62.139
  • Login username: a
  • Login password: test123

Client:

  • IP: 192.168.62.130

The client remotely connects to the server via command line with the following command:

net use \\192.168.52.139 /u:a test123

Simultaneously, the client runs Wireshark to capture data packets, as shown in the figure below.

0x03 Net-NTLM hash — technical illustration 3

The first four packets correspond to the four steps of NTLM authentication

Examine the second packet to obtain the Challenge, which is c0b5429111f9c5f4, as shown in the figure below

0x03 Net-NTLM hash — technical illustration 4

Examine the third packet to obtain the client-encrypted Challenge, which is a9134eee81ca25de, as shown in the figure below

0x03 Net-NTLM hash — technical illustration 5

The Response data is a5f1c47844e5b3b9c6f67736a2e1916d:0101000000000000669dae86ba8bd301a9134eee81ca25de0000000002001e00570049004e002d003100550041004200430047004200470049005500330001001e00570049004e002d003100550041004200430047004200470049005500330004001e00570049004e002d003100550041004200430047004200470049005500330003001e00570049004e002d003100550041004200430047004200470049005500330007000800669dae86ba8bd30106000400020000000800300030000000000000000000000000300000e9d9e613613097d1e2f47c1fd97fa099f65dfd78075d8bdb5ca162492ea5d2990a001000000000000000000000000000000000000900260063006900660073002f003100390032002e003100360038002e00360032002e00310033003900000000000000000000000000, as shown in the figure below

0x03 Net-NTLM hash — technical illustration 6

Next, use Hashcat to crack this Net-NTLM hash

The format of NTLMv2 is:

username::domain:challenge:HMAC-MD5:blob

Note:

challenge is the NTLM Server Challenge, and domain is obtained from the packet content (IP or machine name)

HMAC-MD5 corresponds to the NTProofStr in the packet, as shown in the figure below

0x03 Net-NTLM hash — technical illustration 7

blob corresponds to the latter part of the Response in the packet after removing NTProofStr

Therefore, the complete NTLMv2 data is as follows:

a::192.168.62.139:c0b5429111f9c5f4:a5f1c47844e5b3b9c6f67736a2e1916d:0101000000000000669dae86ba8bd301a9134eee81ca25de0000000002001e00570049004e002d003100550041004200430047004200470049005500330001001e00570049004e002d003100550041004200430047004200470049005500330004001e00570049004e002d003100550041004200430047004200470049005500330003001e00570049004e002d003100550041004200430047004200470049005500330007000800669dae86ba8bd30106000400020000000800300030000000000000000000000000300000e9d9e613613097d1e2f47c1fd97fa099f65dfd78075d8bdb5ca162492ea5d2990a001000000000000000000000000000000000000900260063006900660073002f003100390032002e003100360038002e00360032002e00310033003900000000000000000000000000

For testing convenience, create a new dictionary file with the content test123

The Hashcat parameters are as follows:

hashcat -m 5600 a::192.168.62.139:c0b5429111f9c5f4:a5f1c47844e5b3b9c6f67736a2e1916d:0101000000000000669dae86ba8bd301a9134eee81ca25de0000000002001e00570049004e002d003100550041004200430047004200470049005500330001001e00570049004e002d003100550041004200430047004200470049005500330004001e00570049004e002d003100550041004200430047004200470049005500330003001e00570049004e002d003100550041004200430047004200470049005500330007000800669dae86ba8bd30106000400020000000800300030000000000000000000000000300000e9d9e613613097d1e2f47c1fd97fa099f65dfd78075d8bdb5ca162492ea5d2990a001000000000000000000000000000000000000900260063006900660073002f003100390032002e003100360038002e00360032002e00310033003900000000000000000000000000 /tmp/password.list -o found.txt --force

Explanation:

-m: hash-type, 5600 corresponds to NetNTLMv2. Detailed parameters can be found in the table: https://hashcat.net/wiki/doku.php?

-o: output file

The dictionary file is /tmp/password.list

--force means force execution, as the test system does not support Intel OpenCL

Successfully cracked the plaintext login password, output as shown in the figure below

0x03 Net-NTLM hash — technical illustration 8

In penetration testing, there are typically the following two exploitation methods

1. Use man-in-the-middle attacks to obtain Net-NTLM hash, commonly using tools like Responder and Inveigh

Responder:

Written in Python, reference address:

https://github.com/lgandx/Responder

Inveigh:

Written in PowerShell, reference address:

https://github.com/Kevin-Robertson/Inveigh

Actual test:

Using the same test environment as above, run Inveigh on a test host within the same network segment with the following parameters:

Import-Module .\Inveigh.psd1
Invoke-Inveigh -consoleoutput Y

When a client remotely connects to the server via command line, Inveigh captures the Net-NTLMv2 hash, as shown in the figure below

1. Use man-in-the-middle attacks to obtain Net-NTLM hash, commonly using tools like Responder and Inveigh — technical illustration 9

NTLMv2 hash is a::WIN-FVJLPTISCFE:A944CF357E0938DA:C1BB2CDD038D3AA6FA53FD360D7CBA9C:0101000000000000937115D1BC8BD301033605ACA1ACA1C00000000002001E00570049004E002D003100550041004200430047004200470049005500330001001E00570049004E002D003100550041004200430047004200470049005500330004001E00570049004E002D003100550041004200430047004200470049005500330003001E00570049004E002D003100550041004200430047004200470049005500330007000800937115D1BC8BD30106000400020000000800300030000000000000000100000000200000E9D9E613613097D1E2F47C1FD97FA099F65DFD78075D8BDB5CA162492EA5D2990A001000000000000000000000000000000000000900260063006900660073002F003100390032002E003100360038002E00360032002E00310033003900000000000000000000000000

Hashcat parameters are as follows:

hashcat -m 5600 a::WIN-FVJLPTISCFE:A944CF357E0938DA:C1BB2CDD038D3AA6FA53FD360D7CBA9C:0101000000000000937115D1BC8BD301033605ACA1ACA1C00000000002001E00570049004E002D003100550041004200430047004200470049005500330001001E00570049004E002D003100550041004200430047004200470049005500330004001E00570049004E002D003100550041004200430047004200470049005500330003001E00570049004E002D003100550041004200430047004200470049005500330007000800937115D1BC8BD30106000400020000000800300030000000000000000100000000200000E9D9E613613097D1E2F47C1FD97FA099F65DFD78075D8BDB5CA162492EA5D2990A001000000000000000000000000000000000000900260063006900660073002F003100390032002E003100360038002E00360032002E00310033003900000000000000000000000000 /tmp/password.list --force

Successfully cracked the login plaintext password, output as shown in the figure below

1. Use man-in-the-middle attacks to obtain Net-NTLM hash, commonly using tools like Responder and Inveigh — technical illustration 10

2. Force the target client to initiate an SMB connection to a forged server through various methods, capture packets on the forged server, and obtain the Net-NTLM hash

For the SMB protocol, when a client connects to a server, it first attempts to log in using the local username and password hash by default

Actual test:

Client IP: 192.168.62.139

Server IP: 192.168.62.130

The server runs Wireshark to capture packets

The client attempts to connect to the server. For demonstration purposes, the operation is performed via the interface by directly entering \\192.168.62.130 in the address bar. A dialog box prompts that the username or password is incorrect, as shown in the figure below

2. Force the target client to initiate an SMB connection to a forged server through various methods, capture… — technical illustration 11

At this point, Wireshark on the server has captured the packets, and the Net-NTLMv2 hash is assembled as follows:

a::WIN-FVJLPTISCFE:a05179df44d8cd35:43589a30aea29cf24fbd9c01a85e4b7e:0101000000000000eb8e1d9bf08ed301ca0ea89448cceba80000000002001e00570049004e002d003100550041004200430047004200470049005500330001001e00570049004e002d003100550041004200430047004200470049005500330004001e00570049004e002d003100550041004200430047004200470049005500330003001e00570049004e002d003100550041004200430047004200470049005500330007000800eb8e1d9bf08ed30106000400020000000800300030000000000000000100000000200000e4ab58611d3ed61427fa3c7075c75897aebae420dd42b71c73886ebca92b3c3b0a001000000000000000000000000000000000000900260063006900660073002f003100390032002e003100360038002e00360032002e00310033003900000000000000000000000000

Hashcat parameters are as follows:

hashcat -m 5600 a::WIN-FVJLPTISCFE:a05179df44d8cd35:43589a30aea29cf24fbd9c01a85e4b7e:0101000000000000eb8e1d9bf08ed301ca0ea89448cceba80000000002001e00570049004e002d003100550041004200430047004200470049005500330001001e00570049004e002d003100550041004200430047004200470049005500330004001e00570049004e002d003100550041004200430047004200470049005500330003001e00570049004e002d003100550041004200430047004200470049005500330007000800eb8e1d9bf08ed30106000400020000000800300030000000000000000100000000200000e4ab58611d3ed61427fa3c7075c75897aebae420dd42b71c73886ebca92b3c3b0a001000000000000000000000000000000000000900260063006900660073002f003100390032002e003100360038002e00360032002e00310033003900000000000000000000000000 /tmp/password.list --force

Successfully cracked the plaintext password of the client's current user, output as shown in the figure below

2. Force the target client to initiate an SMB connection to a forged server through various methods, capture… — technical illustration 12

Practical exploitation example:

Sending phishing emails, when users open the email, they covertly access a forged server, which can capture data packets to obtain the target user's current Net-NTLM hash, and further crack it to recover the plaintext password

0x04 Summary

---

This article introduces the differences between NTLM hash and Net-NTLM hash, and practically demonstrates the encryption method of NTLM hash and the cracking method of Net-NTLMv2 hash. If the plaintext password cannot be cracked, Pass-The-Hash can be used for further exploitation of NTLM hash, but what about Net-NTLM hash?

Related Questions & Answers

Which tools are commonly used to capture Net-NTLM hashes, and how do they work?

Two widely used tools are Responder (Python, available at https://github.com/lgandx/Responder) and Inveigh (PowerShell, at https://github.com/Kevin-Robertson/Inveigh). Both operate as MITM listeners on the network, spoofing services like SMB, HTTP, or LLMNR to intercept NTLM authentication attempts. When a client sends a Net-NTLM response to an attacker-controlled service, the tool captures the hash for offline cracking. These tools are essential for lateral movement in penetration tests, especially when combined with techniques like relaying—see the original article's reference to [byt3bl33d3r's guide](https://byt3bl33d3r.github.io/practical-guide-to-ntlm-relaying-in-2017-aka-getting-a-foothold-in-under-5-minutes.html) for more advanced usage.

What is the correct format for a Net-NTLMv2 hash when using Hashcat?

For cracking Net-NTLMv2 hashes with Hashcat (mode 5600), the format is: `username::domain:challenge:HMAC-MD5:blob`. The `challenge` is the NTLM server challenge (16-bit random value), `HMAC-MD5` corresponds to the NTProofStr from the packet, and `blob` is the remainder of the client response after removing NTProofStr. For example, from a packet capture you might assemble a string like `a::192.168.62.139:c0b5429111f9c5f4:a5f1c47844e5b3b9c6f67736a2e1916d:0101000000000000669dae86ba8bd301a9134eee81ca25de...`. This format is essential for successful cracking with Hashcat, as detailed in the [article](/news/introduction-to-windows-password-hashes-ntlm-hash-and-net-ntlm-hash).

How can an attacker obtain a Net-NTLM hash in a network environment?

Attackers can capture Net-NTLM hashes by performing a man-in-the-middle (MITM) attack using tools like Responder (Python) or Inveigh (PowerShell). When a client attempts to authenticate to a server (e.g., via SMB), the attacker intercepts the challenge and response, extracting the Net-NTLM hash. Alternatively, an attacker can force an outbound NTLM authentication request from a target (e.g., via a malicious SMB share or a link in an email) to a controlled system, thereby capturing the hash. The extracted hash can then be cracked offline with tools like Hashcat.

How is an NTLM hash generated from a plaintext password?

First, the plaintext password is converted to hexadecimal format, then transformed into Unicode by appending 0x00 after each byte. This Unicode string is then hashed using the MD4 algorithm to produce a 32-character hexadecimal hash, which is the NTLM hash. For example, the password "test123" becomes the NTLM hash c5a237b7e9d8e708d8436b6148a25fa1—this can be verified with tools like Mimikatz by extracting the hash from the lsass.exe process. Penetration testers often obtain NTLM hashes from the SAM file or NTDS.dit, as discussed in [Penetration Techniques - Obtaining Local User Hashes via SAM Database](/news/penetration-techniques-obtaining-local-user-hashes-via-sam-database).

What is the difference between an NTLM hash and a Net-NTLM hash?

An NTLM hash is the user password hash stored locally in the Windows Security Account Manager (SAM) or in the NTDS.dit file on domain controllers, derived by MD4-encrypting the Unicode representation of the plaintext password. In contrast, a Net-NTLM hash is the hash that appears in network NTLM authentication as part of the challenge/response process—the client encrypts a server-issued challenge (a random 16-bit value) using its NTLM hash, and the resulting response contains the Net-NTLM hash. For more details, see [Introduction to Windows Password Hashes - NTLM Hash and Net-NTLM Hash](/news/introduction-to-windows-password-hashes-ntlm-hash-and-net-ntlm-hash).

Continue Reading