World Library  
Flag as Inappropriate
Email this Article

LM hash

LM hash, LanMan hash, or LAN Manager hash is a compromised password hashing function that was the primary hash that Microsoft LAN Manager and Microsoft Windows versions prior to Windows NT used to store user passwords. Support for the legacy LAN Manager protocol continued in later versions of Windows for backward compatibility, but was recommended by Microsoft to be turned off by administrators; as of Windows Vista, the protocol is disabled by default, but continues to be used by some non-Microsoft CIFS implementations.


  • Algorithm 1
  • Security weaknesses 2
  • Workarounds 3
  • Reasons for continued use 4
  • See also 5
  • Notes 6
  • References 7
  • External links 8


The LM hash is computed as follows:[1][2]

  1. The user's password is restricted to a maximum of fourteen characters.[Notes 1]
  2. The user’s password is converted to uppercase.
  3. The user's password is encoded in the System OEM Code page[3]
  4. This password is null-padded to 14 bytes.[4]
  5. The “fixed-length” password is split into two 7-byte halves.
  6. These values are used to create two DES keys, one from each 7-byte half, by converting the seven bytes into a bit stream with the most significant bit first, and inserting a null bit after every seven bits (so 1010100 becomes 10101000). This generates the 64 bits needed for a DES key. (A DES key ostensibly consists of 64 bits; however, only 56 of these are actually used by the algorithm. The null bits added in this step are later discarded.)
  7. Each of the two keys is used to DES-encrypt the constant ASCII string “KGS!@#$%”,[Notes 2] resulting in two 8-byte ciphertext values. The DES CipherMode should be set to ECB, and PaddingMode should be set to NONE.
  8. These two ciphertext values are concatenated to form a 16-byte value, which is the LM hash.

Security weaknesses

Although it is based on DES, a well-studied and formerly secure block cipher, the LM hash is not a true one-way function as the password can be determined from the hash because of several weaknesses in its design:[5] Firstly, passwords are limited to a maximum of only 14 characters, giving a theoretical maximum keyspace of 95^{14} \approx 2^{92} with the 95 ASCII printable characters.

Secondly, passwords longer than 7 characters are divided into two pieces and each piece is hashed separately; this weakness allows each half of the password to be attacked separately at exponentially lower cost than the whole, as only 95^{7} \approx 2^{46} different 7-character password pieces are possible with the same character set. By mounting a brute force attack on each half separately, modern desktop machines can crack alphanumeric LM hashes in a few hours. In addition, all lower case letters in the password are changed to upper case before the password is hashed, which further reduces the key space for each half to 69^{7} \approx 2^{43}.

The LM hash also does not use cryptographic salt, a standard technique to prevent pre-computed dictionary attacks. A time-memory trade-off cryptanalysis attack, such as a rainbow table, is therefore feasible. In addition, any password that is shorter than 8 characters will result in the hashing of 7 null bytes, yielding the constant value of 0xAAD3B435B51404EE, hence making it easy to identify short passwords on sight. 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 fast and trivial.

A final weakness of LM hashes lies in their implementation — since they change only when a user changes their password, they can be used to carry out a pass the hash attack.


To address the security weaknesses inherent in LM encryption and authentication schemes, Microsoft introduced the NTLMv1 protocol in 1993 with Windows NT 3.1. For hashing, NTLM uses Unicode support, replacing LMhash=DESeach(DOSCHARSET(UPPERCASE(password)), "KGS!@#$%") by NThash=MD4(UTF-16-LE(password)), which does not require any padding or truncating that would simplify the key. On the negative side, the same DES algorithm was used with only 56-bit encryption for the subsequent authentication steps, and there is still no salting. Furthermore, Windows machines were for many years configured by default to send and accept responses derived from both the LM hash and the NTLM hash, so the use of the NTLM hash provided no additional security while the weaker hash was still present. It also took time for artificial restrictions on password length in management tools such as User Manager to be lifted.

While LAN Manager is considered obsolete and current Windows operating systems use the stronger NTLMv2 or Kerberos authentication methods, Windows systems before Windows Vista/Windows Server 2008 enabled the LAN Manager hash by default for backward compatibility with legacy LAN Manager and Windows Me or earlier clients, or legacy NetBIOS-enabled applications. It has for many years been considered good security practice to disable the compromised LM and NTLMv1 authentication protocols where they aren't needed.[6] Starting with Windows Vista and Windows Server 2008, Microsoft disabled the LM hash 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 via domain Group Policy. The same method can be used to turn the feature off in Windows 2000, Windows XP and NT.[6] Users can also prevent a LM hash from being generated for their own password by using a password at least fifteen characters in length.[4]

Reasons for continued use

Many legacy third party CIFS implementations have taken considerable time to add support for the stronger protocols that Microsoft has created to replace LM hashing because the open source communities supporting these libraries first had to reverse engineer the newer protocols—Samba took 5 years to add NTLMv2 support, while JCIFS took 10 years.

Availability of NTLM protocols to replace LM authentication
Product NTLMv1 support NTLMv2 support
Windows NT 3.1 RTM (1993) Not supported
Windows NT 3.5 RTM (1994) Not supported
Windows NT 3.51 RTM (1995) Not supported
Windows NT 4 RTM (1996) Service Pack 4[7] (25 October 1998)
Windows 95 Not supported Directory services client (released with Windows 2000 Server, 17 February 2000)
Windows 98 RTM Directory services client (released with Windows 2000 Server, 17 February 2000)
Windows 2000 RTM (17 February 2000) RTM (17 February 2000)
Windows ME RTM (14 September 2000) Directory services client (released with Windows 2000 Server, 17 February 2000)
Samba ? Version 3.0[8] (24 September 2003)
JCIFS Not supported Version 1.3.0 (25 October 2008)[9]
IBM AIX (SMBFS) 5.3 (2004)[10] Not supported as of v7.1[11]

Poor patching regimes subsequent to software releases supporting the feature becoming available have contributed to some organisations continuing to use LM Hashing in their environments, even though the protocol is easily disabled in Active Directory itself.

Lastly, prior to the release of Windows Vista, many unattended build processes still used a DOS boot disk (instead of Windows PE) to start the installation of Windows using WINNT.EXE, something that requires LM hashing to be enabled for the legacy LAN Manager networking stack to work.

See also


  1. ^ If the password is more than fourteen characters long, the LM hash cannot be computed.
  2. ^ The string “KGS!@#$%” could possibly mean Key of Glen and Steve and then the combination of Shift + 12345. Glen Zorn and Steve Cobb are the authors of RFC 2433 (Microsoft PPP CHAP Extensions).


  1. ^ "Chapter 3 - Operating System Installation: The LMHash".  
  2. ^ Glass, Eric (2006). "The NTLM Authentication Protocol and Security Support Provider: The LM Response". Retrieved 2015-05-12. 
  3. ^ "List of Localized MS Operating Systems".  
  4. ^ a b "Cluster service account password must be set to 15 or more characters if the NoLMHash policy is enabled".  
  5. ^ Johansson, Jasper M. (2004-06-29). "Windows Passwords: Everything You Need To Know".  
  6. ^ a b "How to prevent Windows from storing a LAN manager hash of your password in Active Directory and local SAM databases".  
  7. ^ "Windows NT 4.0 Service Pack 4 Readme.txt File (40-bit)".  
  8. ^ "The Samba Team announces the first official release of Samba 3.0".  
  9. ^ "The Java CIFS Client Library". Retrieved 2015-05-12. 
  10. ^ "AIX 5.3 Networks and communication management: Server Message Block file system".  
  11. ^ "AIX 7.1 Networks and communication management: Server Message Block file system".  

External links

  • Oechslin, Philippe (2003). "Making a Faster Cryptanalytic Time-Memory Trade-Off" (PDF). Advances in Cryptology, CRYPTO 2003. 
  • "Ophcrack, a well known password cracker". 
  • "Cain and Abel, password recovery tool for Microsoft Operating Systems". 
  • mudge (1997-07-24). "A L0phtCrack Technical Rant". Archived from the original on 1997-07-24. 
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.

Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.