homepage
Menu
Open menu
  • Training
    Go one level top Back

    Training

    • Courses

      Build cyber prowess with training from renowned experts

    • Hands-On Simulations

      Hands-on learning exercises keep you at the top of your cyber game

    • Certifications

      Demonstrate cybersecurity expertise with GIAC certifications

    • Ways to Train

      Multiple training options to best fit your schedule and preferred learning style

    • Training Events & Summits

      Expert-led training at locations around the world

    • Free Training Events

      Upcoming workshops, webinars and local events

    • Security Awareness

      Harden enterprise security with end-user and role-based training

    Featured: Solutions for Emerging Risks

    Discover tailored resources that translate emerging threats into actionable strategies

    Risk-Based Solutions

    Can't find what you are looking for?

    Let us help.
    Contact us
  • Learning Paths
    Go one level top Back

    Learning Paths

    • By Focus Area

      Chart your path to job-specific training courses

    • By NICE Framework

      Navigate cybersecurity training through NICE framework roles

    • DoDD 8140 Work Roles

      US DoD 8140 Directive Frameworks

    • By European Skills Framework

      Align your enterprise cyber skills with ECSF profiles

    • By Skills Roadmap

      Find the right training path based on critical skills

    • New to Cyber

      Give your cybersecurity career the right foundation for success

    • Leadership

      Training designed to help security leaders reduce organizational risk

    • Degree and Certificate Programs

      Gain the skills, certifications, and confidence to launch or advance your cybersecurity career.

    Featured

    New to Cyber resources

    Start your career
  • Community Resources
    Go one level top Back

    Community Resources

    Watch & Listen

    • Webinars
    • Live Streams
    • Podcasts

    Read

    • Blog
    • Newsletters
    • White Papers
    • Internet Storm Center

    Download

    • Open Source Tools
    • Posters & Cheat Sheets
    • Policy Templates
    • Summit Presentations
    • SANS Community Benefits

      Connect, learn, and share with other cybersecurity professionals

    • CISO Network

      Engage, challenge, and network with fellow CISOs in this exclusive community of security leaders

  • For Organizations
    Go one level top Back

    For Organizations

    Team Development

    • Why Partner with SANS
    • Group Purchasing
    • Skills & Talent Assessments
    • Private & Custom Training

    Leadership Development

    • Leadership Courses & Accreditation
    • Executive Cybersecurity Exercises
    • CISO Network

    Security Awareness

    • End-User Training
    • Phishing Simulation
    • Specialized Role-Based Training
    • Risk Assessments
    • Public Sector Partnerships

      Explore industry-specific programming and customized training solutions

    • Sponsorship Opportunities

      Sponsor a SANS event or research paper

    Interested in developing a training plan to fit your organization’s needs?

    We're here to help.
    Contact us
  • Talk with an expert
  • Log In
  • Join - it's free
  • Account
    • Account Dashboard
    • Log Out
  1. Home >
  2. Blog >
  3. Protecting Privileged Domain Accounts: LM Hashes: The Good, the Bad, and the Ugly
370x370_Mike-Pilkington.jpg
Mike Pilkington

Protecting Privileged Domain Accounts: LM Hashes: The Good, the Bad, and the Ugly

February 29, 2012

[Author's Note: This is the 2nd in a multi-part series on the topic of "Protecting Privileged Domain Accounts". My primary goal is to help incident responders protect their privileged accounts when interacting with comprised hosts, though I also believe this information will be useful to anyone administering and defending a Windows environment.]

I realize the LanMan (LM) hash is old-hat for many, but I've recently discovered that the LM hash is even more dangerous than I previously realized. This is due to both the ease of cracking LM hashes on today's hardware, as well as the obscure fact that there is currently no Microsoft-provided feature to remove LM hashes from memory. So even if you think you've heard it all with regard to LM hashes, I encourage you to read on to make sure you are aware of LM hashes lurking in memory.

The Bad

Although the issues with LM hashes are well-documented, let me just briefly describe how LM hashes are created and you will immediately recognize several significant issues with this algorithm. These issues highlight exactly why we need to get rid of the LM hash. In a nutshell, here's how the algorithm works, per Wikipedia:

  • The user's ASCII password is converted to uppercase
  • This password is null-padded to 14 bytes
  • The "fixed-length" 14-byte password is split into two 7-byte halves
  • Each of the two halves is used with the DES function to create two 8-byte cipher-text values
  • The two cipher-text values are concatenated to form a 16-byte value, which is the LM hash
  • No salt is used in the creation of the hash

There are plenty of bad choices that were made in the design of this algorithm. Let me quickly point out a few:

  • The fact that each character is an ASCII character, which provides just 95 printable characters, means that there should be only 95 possibilities per character of the password. However, it's worse than that because each lowercase character is converted to uppercase, so in fact there are only 69 possibilities per character of the password.
  • The maximum number of characters in a password is 14. Anything less than that gets padded with null bytes to 14. The resulting 14-character value is then split in half. Splitting the value in half greatly reduces the search space for any password cracking software. It now just has to guess 2 values within 697 (~7.5 trillion) versus one value within 6914 (~ 55 septillion). This results in nearly 13 orders of magnitude difference, making it a significantly easier problem for cracking software to solve for the two 7-character halves.
  • Finally, there is no salt. A salt is an extra piece of data, which typically differs per machine and/or per user, that is added to the clear-text password so that the output of the hashing algorithm will not be the same when two users have the same password. For example, without adding a salt, it means that if your password is "abc123" and my password is "abc123", our hash values will be the same. Since they are the same, it's possible to pre-compute many common (or uncommon) passwords and store them with their corresponding hash for quick and easy retrieval.

These significant issues are the reasons that pre-computed rainbow table attacks are so effective against LM hashes. The most effective pre-computed attack against LM hashes that I have seen was brought to my attention by Chad Tilbury. While teaching SANS Forensics 408, Chad pointed out to the class this project to put the LM hash rainbow tables on solid state drives. This is an incredibly fast and inexpensive solution for cracking very complex 14-character passwords in just 5-11 seconds! What does this mean? This means that if your (or your users') LM hash is available to an attacker, they will know the clear-text password almost instantly.

The Ugly

So if all that isn't ugly enough, let's move on to the really ugly stuff. But before we do, I need to point out that Microsoft has long recognized the weaknesses of the LM hash and provided us with some techniques for disabling its use. Let me review these techniques and then I'll show you a glaring omission in Microsoft's attempts to protect us from the LM hash.

By default, Windows Vista and higher no longer store LM hashes on disk (in the SAM database) by enabling the "NoLMHash" Registry setting. Furthermore, this MS article describes how to disable it for older operating system versions, as well as in Active Directory. In a nutshell, it describes how to push the NoLMHash setting via Group Policy, as shown here on my test domain controller:


"NoLMHash" Registry setting
"NoLMHash" Registry setting

Another mitigation option from Microsoft provides a way to prevent Windows from authenticating with the LMv1/LMv2 challenge-response network authentication protocol. In the next few weeks I will post an article to discuss network authentication in-depth, so I won't go into all the inner workings here. Suffice it to say that an LM hash is required to complete LMv1 or LMv2 challenge-response network authentication. So if we disable the LM challenge-response protocols as provided by Microsoft, and specify that only the newer NTLMv2 protocol be used (which only requires the NT hash, not the LM hash), then Windows shouldn't need the LM hash, right? That's my thinking.

So here I have changed the network authentication level to the most secure setting, which is to only allow NTLMv2 (as well as Kerberos)-effectively disabling the LM challenge-response protocols:

NTLMv2
NTLMv2

Now I want to test the effectiveness of these changes and see if it truly disables LM hashes as I would expect. I will do this on a Windows 7 SP1 system, hoping that the latest OS will provide the necessary protection against storing LM hashes.

On my Windows 7 test machine named USER-WIN7, which is joined to the MSAD2 test domain I used in my previous article, I updated Group Policy to reflect the changes made above to the domain's GPO. Here are the new settings reflected on the Windows 7 client:

Windows 7 client
Windows 7 client

For good measure, I have also changed local account MIKE's password and domain account MSAD2-RESPONDER2's password and then rebooted the machine:

MSAD2-RESPONDER2
MSAD2-RESPONDER2

Now here's where it gets really ugly. Having implemented the policy to disable the storage of LM hashes, we should not see LM hashes stored on disk. And by implementing the policy to disable the LM challenge-response protocols over the network, there should be no need for the LM hash to be stored in memory. After all, why would it, since it is not needed for local or remote use now? Well, time to see what happens in practice.

After making the changes above to presumably prevent the use and storage of LM hashes, I've logged on at the console of the Windows 7 host as domain user MSAD2-RESPONDER2. I have also issued the RunAs command to logon the local user MIKE. This will allow us to see both users' hashes loaded into memory. (Remember, an account must have a current "interactive" logon session in order for the hashes to be found in memory?see my article on password hashes for details).

Let's first look at the local hashes on disk.

  • So here I've run pwdump6, which will show the hashes on disk (in the SAM), for the local user accounts only:
pwdump6
pwdump6

As expected, no LM hashes are available. The first 2 accounts are disabled by default and no password was ever set for them. For user account MIKE, only his NT hash is available. So far, so good!

Now we need to look at what hashes are in memory.

  • For this task, I'll use Windows Credentials Editor (WCE).
Windows Credentials Editor
Windows Credentials Editor

This is not good at all! It turns out that Windows calculates and stores the LM hash in memory, assuming the password is less than 15 characters, regardless of what the host or domain settings are for LM hash storage and LM challenge-response!

Now with the LM hashes in hand, we can easily crack the passwords. Here I'm using the previously discussed SSD implementation of the LM rainbow tables from Objectif Sécurité:

  • Local account MIKE's cracked password:
cracked password
cracked password
  • Domain account MSAD2-RESPONDER2's cracked password:
MSAD2-RESPONDER2's cracked password
MSAD2-RESPONDER2's cracked password

This is scary stuff! This means that essentially any user who has their machine comprised and hashes dumped from memory will have effectively divulged their clear-text password, since freely-available LM rainbow tables can crack the most complex 14-character passwords in just seconds.

Let that sink in for a second... I discussed last time how devastating pass-the-hash attacks can be, which is absolutely the case. However, if attackers can just get the actual password, in most environments that opens up many more systems to attack from inside and often outside the network.

This issue of having LM hashes in memory was identified in Hernan Ochoa's paper describing his tool Windows Credentials Editor (see page 23 of his paper). For confirmation beyond Hernan's paper and my own testing, I contacted Microsoft about this issue and the unofficial response I received was that they are aware of the problem. The general message was that even if they were to fix this problem, there are still the significant issues of pass-the-hash as well as LSA-encrypted passwords (which I'll cover next week), so they don't see enough reward versus the risk of changing a significant piece of their code base.

The Good

I realize this is a stretch, but here's what I will label as the one "good" thing about the LM hash?the fact that a 15-character password or greater will completely break the algorithm, and thus Windows cannot calculate and store the LM hash in memory (or on disk). So here's our one defense for this issue, make your passwords 15 or more characters!

To demonstrate this, I will change local user MIKE's password and domain user MSAD2-RESPONDER2's password to a value greater than 14 characters:

Changed passwords
Changed passwords

Now after a logoff/logon, let's recheck those hashes in memory:

hashes in memory
hashes in memory

Whew! The one redeeming value of the LM hash algorithm?the fact that we can completely break it with a sufficiently long password. A nice side effect of this is that with a password of 15 or more characters, you'll also make your NT hash very resistant to pre-computed attacks. That said, we still have to protect the NT hash to avoid pass-the-hash attacks. As discussed in my last article, the way to do this is to avoid interactive logons with privileged accounts.

Conclusion

With the effectiveness of LM rainbow tables on today's hardware, we have to consider LM hashes effectively equivalent to clear-text passwords. Unfortunately, we do not have a Microsoft-provided mechanism for disabling the LM hash in memory. So for accounts you use for interactive logons, your only defense is to make sure you set your passwords to be 15 characters or more in order to break the LM hash algorithm.

This is a fairly easy solution for one-off accounts, but it gets much more difficult when trying to protect thousands of end-user accounts. While you will probably get significant push back (and maybe some laughter too), it is worth at least discussing the implementation of a 15-character password policy, or passphrase policy, for your organization. That, or put pressure on Microsoft to give us better option.

More to come next week, so stay tuned!

Mike Pilkington is a Sr.Security Analyst and Incident Responder for a global Fortune 500 company in Houston, TX, as well as a SANS Mentor and Community Instructor.

Share:
TwitterLinkedInFacebook
Copy url Url was copied to clipboard
Subscribe to SANS Newsletters
Receive curated news, vulnerabilities, & security awareness tips
United States
Canada
United Kingdom
Spain
Belgium
Denmark
Norway
Netherlands
Australia
India
Japan
Singapore
Afghanistan
Aland Islands
Albania
Algeria
American Samoa
Andorra
Angola
Anguilla
Antarctica
Antigua and Barbuda
Argentina
Armenia
Aruba
Austria
Azerbaijan
Bahamas
Bahrain
Bangladesh
Barbados
Belarus
Belize
Benin
Bermuda
Bhutan
Bolivia
Bonaire, Sint Eustatius, and Saba
Bosnia And Herzegovina
Botswana
Bouvet Island
Brazil
British Indian Ocean Territory
Brunei Darussalam
Bulgaria
Burkina Faso
Burundi
Cambodia
Cameroon
Cape Verde
Cayman Islands
Central African Republic
Chad
Chile
China
Christmas Island
Cocos (Keeling) Islands
Colombia
Comoros
Cook Islands
Costa Rica
Cote D'ivoire
Croatia (Local Name: Hrvatska)
Curacao
Cyprus
Czech Republic
Democratic Republic of the Congo
Djibouti
Dominica
Dominican Republic
East Timor
Ecuador
Egypt
El Salvador
Equatorial Guinea
Eritrea
Estonia
Eswatini
Ethiopia
Falkland Islands (Malvinas)
Faroe Islands
Fiji
Finland
France
French Guiana
French Polynesia
French Southern Territories
Gabon
Gambia
Georgia
Germany
Ghana
Gibraltar
Greece
Greenland
Grenada
Guadeloupe
Guam
Guatemala
Guernsey
Guinea
Guinea-Bissau
Guyana
Haiti
Heard And McDonald Islands
Honduras
Hong Kong
Hungary
Iceland
Indonesia
Iraq
Ireland
Isle of Man
Israel
Italy
Jamaica
Jersey
Jordan
Kazakhstan
Kenya
Kiribati
Korea, Republic Of
Kosovo
Kuwait
Kyrgyzstan
Lao People's Democratic Republic
Latvia
Lebanon
Lesotho
Liberia
Liechtenstein
Lithuania
Luxembourg
Macau
Madagascar
Malawi
Malaysia
Maldives
Mali
Malta
Marshall Islands
Martinique
Mauritania
Mauritius
Mayotte
Mexico
Micronesia, Federated States Of
Moldova, Republic Of
Monaco
Mongolia
Montenegro
Montserrat
Morocco
Mozambique
Myanmar
Namibia
Nauru
Nepal
Netherlands Antilles
New Caledonia
New Zealand
Nicaragua
Niger
Nigeria
Niue
Norfolk Island
North Macedonia
Northern Mariana Islands
Oman
Pakistan
Palau
Palestine
Panama
Papua New Guinea
Paraguay
Peru
Philippines
Pitcairn
Poland
Portugal
Puerto Rico
Qatar
Reunion
Romania
Russian Federation
Rwanda
Saint Bartholemy
Saint Kitts And Nevis
Saint Lucia
Saint Martin
Saint Vincent And The Grenadines
Samoa
San Marino
Sao Tome And Principe
Saudi Arabia
Senegal
Serbia
Seychelles
Sierra Leone
Sint Maarten
Slovakia
Slovenia
Solomon Islands
South Africa
South Georgia and the South Sandwich Islands
South Sudan
Sri Lanka
St. Helena
St. Pierre And Miquelon
Suriname
Svalbard And Jan Mayen Islands
Sweden
Switzerland
Taiwan
Tajikistan
Tanzania, United Republic Of
Thailand
Togo
Tokelau
Tonga
Trinidad And Tobago
Tunisia
Turkey
Turkmenistan
Turks And Caicos Islands
Tuvalu
Uganda
Ukraine
United Arab Emirates
United States Minor Outlying Islands
Uruguay
Uzbekistan
Vanuatu
Vatican City State
Venezuela
Vietnam
Virgin Islands (British)
Virgin Islands (U.S.)
Wallis And Futuna Islands
Western Sahara
Yemen
Zambia
Zimbabwe

By providing this information, you agree to the processing of your personal data by SANS as described in our Privacy Policy.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Tags:
  • Digital Forensics, Incident Response & Threat Hunting

Related Content

Blog
Blog Teaser: Shoplifting2.0 340x340.jpg
Digital Forensics, Incident Response & Threat Hunting
May 21, 2025
Shoplifting 2.0: When it’s Data the Thieves Steal
Identify steps organisations can implement to protect against Scattered Spider and DragonForce
Adam Harrison
Adam Harrison
read more
Blog
emerging threats summit 340x340.png
Digital Forensics, Incident Response & Threat Hunting, Offensive Operations, Pen Testing, and Red Teaming, Cyber Defense, Industrial Control Systems Security, Cybersecurity Leadership
May 14, 2025
Visual Summary of SANS Emerging Threats Summit 2025
Check out these graphic recordings created in real-time throughout the event for SANS Emerging Threats Summit 2025
No Headshot Available
Alison Kim
read more
Blog
powershell_option_340x340.jpg
Cyber Defense, Digital Forensics, Incident Response & Threat Hunting, Cybersecurity and IT Essentials, Offensive Operations, Pen Testing, and Red Teaming
July 12, 2022
Month of PowerShell - Windows File Server Enumeration
In this Month of PowerShell article we look at several commands to interrogate Windows SMB servers as part of our incident response toolkit.
Josh Wright - Headshot - 370x370 2025.jpg
Joshua Wright
read more
  • Company
  • Mission
  • Instructors
  • About
  • FAQ
  • Press
  • Contact Us
  • Careers
  • Policies
  • Training Programs
  • Work Study
  • Academies & Scholarships
  • Public Sector Partnerships
  • Law Enforcement
  • SkillsFuture Singapore
  • Degree Programs
  • Get Involved
  • Join the Community
  • Become an Instructor
  • Become a Sponsor
  • Speak at a Summit
  • Join the CISO Network
  • Award Programs
  • Partner Portal
Subscribe to SANS Newsletters
Receive curated news, vulnerabilities, & security awareness tips
United States
Canada
United Kingdom
Spain
Belgium
Denmark
Norway
Netherlands
Australia
India
Japan
Singapore
Afghanistan
Aland Islands
Albania
Algeria
American Samoa
Andorra
Angola
Anguilla
Antarctica
Antigua and Barbuda
Argentina
Armenia
Aruba
Austria
Azerbaijan
Bahamas
Bahrain
Bangladesh
Barbados
Belarus
Belize
Benin
Bermuda
Bhutan
Bolivia
Bonaire, Sint Eustatius, and Saba
Bosnia And Herzegovina
Botswana
Bouvet Island
Brazil
British Indian Ocean Territory
Brunei Darussalam
Bulgaria
Burkina Faso
Burundi
Cambodia
Cameroon
Cape Verde
Cayman Islands
Central African Republic
Chad
Chile
China
Christmas Island
Cocos (Keeling) Islands
Colombia
Comoros
Cook Islands
Costa Rica
Cote D'ivoire
Croatia (Local Name: Hrvatska)
Curacao
Cyprus
Czech Republic
Democratic Republic of the Congo
Djibouti
Dominica
Dominican Republic
East Timor
Ecuador
Egypt
El Salvador
Equatorial Guinea
Eritrea
Estonia
Eswatini
Ethiopia
Falkland Islands (Malvinas)
Faroe Islands
Fiji
Finland
France
French Guiana
French Polynesia
French Southern Territories
Gabon
Gambia
Georgia
Germany
Ghana
Gibraltar
Greece
Greenland
Grenada
Guadeloupe
Guam
Guatemala
Guernsey
Guinea
Guinea-Bissau
Guyana
Haiti
Heard And McDonald Islands
Honduras
Hong Kong
Hungary
Iceland
Indonesia
Iraq
Ireland
Isle of Man
Israel
Italy
Jamaica
Jersey
Jordan
Kazakhstan
Kenya
Kiribati
Korea, Republic Of
Kosovo
Kuwait
Kyrgyzstan
Lao People's Democratic Republic
Latvia
Lebanon
Lesotho
Liberia
Liechtenstein
Lithuania
Luxembourg
Macau
Madagascar
Malawi
Malaysia
Maldives
Mali
Malta
Marshall Islands
Martinique
Mauritania
Mauritius
Mayotte
Mexico
Micronesia, Federated States Of
Moldova, Republic Of
Monaco
Mongolia
Montenegro
Montserrat
Morocco
Mozambique
Myanmar
Namibia
Nauru
Nepal
Netherlands Antilles
New Caledonia
New Zealand
Nicaragua
Niger
Nigeria
Niue
Norfolk Island
North Macedonia
Northern Mariana Islands
Oman
Pakistan
Palau
Palestine
Panama
Papua New Guinea
Paraguay
Peru
Philippines
Pitcairn
Poland
Portugal
Puerto Rico
Qatar
Reunion
Romania
Russian Federation
Rwanda
Saint Bartholemy
Saint Kitts And Nevis
Saint Lucia
Saint Martin
Saint Vincent And The Grenadines
Samoa
San Marino
Sao Tome And Principe
Saudi Arabia
Senegal
Serbia
Seychelles
Sierra Leone
Sint Maarten
Slovakia
Slovenia
Solomon Islands
South Africa
South Georgia and the South Sandwich Islands
South Sudan
Sri Lanka
St. Helena
St. Pierre And Miquelon
Suriname
Svalbard And Jan Mayen Islands
Sweden
Switzerland
Taiwan
Tajikistan
Tanzania, United Republic Of
Thailand
Togo
Tokelau
Tonga
Trinidad And Tobago
Tunisia
Turkey
Turkmenistan
Turks And Caicos Islands
Tuvalu
Uganda
Ukraine
United Arab Emirates
United States Minor Outlying Islands
Uruguay
Uzbekistan
Vanuatu
Vatican City State
Venezuela
Vietnam
Virgin Islands (British)
Virgin Islands (U.S.)
Wallis And Futuna Islands
Western Sahara
Yemen
Zambia
Zimbabwe

By providing this information, you agree to the processing of your personal data by SANS as described in our Privacy Policy.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
  • Privacy Policy
  • Terms and Conditions
  • Do Not Sell/Share My Personal Information
  • Contact
  • Careers
© 2025 The Escal Institute of Advanced Technologies, Inc. d/b/a SANS Institute. Our Terms and Conditions detail our trademark and copyright rights. Any unauthorized use is expressly prohibited.
  • Twitter
  • Facebook
  • Youtube
  • LinkedIn