LM hash

From Wikipedia, the free encyclopedia

Jump to: navigation, search

LM hash or LAN Manager hash is one of the formats that Microsoft LAN Manager and Microsoft Windows versions previous to Windows Vista use to store user passwords that are fewer than 15 characters long. This type of hash is the only type of encryption used in Microsoft LAN Manager, hence the name, and versions of Windows up to Windows Me. It is also supported in more recent Windows versions for backward compatibility, although in Windows Vista it must be manually enabled for use.

Contents

[edit] Algorithm

The LM hash is computed as follows.[1]

  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, by converting the seven bytes into a bit stream, and inserting a zero bit after every seven bits. This generates the 64 bits needed for the DES key.
  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 well-studied 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 95^{14} \approx 2^{92} different passwords made of up to 14 printable ASCII characters, there would be only 95^{7} \approx 2^{46} different 7 character password pieces using the same character set. Restricting the character set by converting lowercase to uppercase further reduces the number of possibilities for each half to 69^{7} \approx 2^{43}. By mounting a brute force attack on each half separately, modern desktop machines can crack alphanumeric LM hashes in a few hours.

LM hash does not include salt, therefore a time-memory trade-off cryptanalysis attack, such as rainbow tables, is also feasible. In 2003, Ophcrack, an implementation of the rainbow table technique, was published. It specifically targets the weaknesses of LM encryption, and includes pre-computed data sufficient to crack virtually all alphanumeric LM hashes in a few seconds. Many cracking tools, e.g. RainbowCrack, L0phtCrack and Cain, now incorporate similar attacks and make cracking of LM hashes trivial. However, because LM hashing is not used for passwords of 15 characters or longer, these are relatively strong.

[edit] Workarounds

To address the security weaknesses inherent in LM encryption, Microsoft introduced the NTLM algorithm with Windows NT 3.1. While LAN Manager is considered obsolete and current Windows operating systems use the stronger NTLM, NTLMv2 or Kerberos hashing methods, Windows systems before Windows Vista/Windows Server 2008 still compute and store the LAN Manager hash by default for compatibility with LAN Manager and Windows Me or earlier clients, as well as some 16-bit applications that are still in use on the most current versions of Windows. It is considered good security practice to disable this feature where it isn't needed.[2] Microsoft claimed that support for LM would be completely eliminated in the Windows Vista operating system.[3] However Windows Vista and Windows Server 2008 still include support for the LM hash, although it is now disabled by default; the feature can be enabled for local accounts via a security policy setting, and for Active Directory accounts by applying the same setting to domain controllers. The same method can be used to turn the feature off in Windows 2000, Windows XP and NT.[4] Users can also prevent a LM hash from being generated for their password by using a password at least 15 characters in length.

[edit] Reasons for continued use

Many SMB implementations support LM Hashing, and can be a reason in corporations for LM Hashing still being required on clients for backward compatibility, even where it is disabled in Active Directory itself. Furthermore, prior to Windows Vista, many unattended build processes still used a DOS boot disk to start the installation of Windows, something that requires LM hashing to be enabled for the legacy LAN Manager networking stack to work. Lastly, some legacy applications that need to perform authentication, such as the 16-bit Microsoft SNA Server client, still use the protocol even under Windows Vista.

[edit] See also

[edit] References

[edit] External links

Personal tools