Hak5
Save 10% at GoDaddy.com with coupon code HAK

LanMan

From Hak5

Jump to: navigation, search

LanManager Hashes, or LM Hashes or LanMan Hashes, are the method in which windows NT (NT/2000/ME/XP/Vista?) based machines store their passwords. As a password is created, it is encrypted according to the LM Hash algorithm, and turned into a series of alphanumeric characters. It is now considered incredibly weak and is being replaced by the NTLM algorithm.

[edit] Algorithm

The LM hash is computed as follows.

  1. The user’s password as an OEM string is converted to uppercase.
  2. This password is either null-padded or truncated to 14 bytes.
  3. The “fixed-length” password is split into two 7-byte halves.
  4. These values are used to create two DES keys, one from each 7-byte half.
  5. Each of these keys is used to DES-encrypt the constant ASCII string “KGS!@#$%”, resulting in two 8-byte ciphertext values.
  6. These two ciphertext values are concatenated to form a 16-byte value, which is the LM hash.

[edit] Security weaknesses

Although it is based on DES, a reasonably secure block cipher, the LM hash can easily be cracked due to two weaknesses in its implementation. First, passwords longer than 7 characters are divided into two pieces and each piece is hashed separately. Second, all lower case letters in the password are changed to upper case before the password is hashed. The first weakness allows each half of the password to be attacked separately. While there are 2^84 different passwords made of up to 14 mixed case letters and digits, there would be only 2^42 different 1-7 character password pieces using the same character set. Restricting the character set to upper case letters and digits further reduces the number of possibilities for each half to 2^36. By mounting a brute force attack on each half separately, modern desktop machines can crack alphanumeric LM hashes in hours.

Because LM hash does not include salt, a time-memory trade-off cryptanalysis attack is also feasible (See Rainbow Tables). LM Hashes are retrievable from a system for time-memory trade-off cryptanalysis with use of a password dumping tool. Several tools exist for the job:

These tools output several different formats for keeping track and databasing the hashes which are found on a system. The most common output is something similar to:

Username:500:7584248B8D2C9F9EAAD3B435B51404EE:186CB09181E2C2ECAAC768C47C729904:::

There is a limitation to how far you can exploit LM Hashes to crack them. If a Windows password is greater than 14 characters long, it will not be stored as an LM hash on the system, instead you will need to refer to the NTLM Hash algorithm.