homepage
Open menu
Go one level top
  • Train and Certify
    Train and Certify

    Immediately apply the skills and techniques learned in SANS courses, ranges, and summits

    • Overview
    • Courses
      • Overview
      • Full Course List
      • By Focus Areas
        • Cloud Security
        • Cyber Defense
        • Cybersecurity and IT Essentials
        • DFIR
        • Industrial Control Systems
        • Offensive Operations
        • Management, Legal, and Audit
      • By Skill Levels
        • New to Cyber
        • Essentials
        • Advanced
        • Expert
      • Training Formats
        • OnDemand
        • In-Person
        • Live Online
      • Course Demos
    • Training Roadmaps
      • Skills Roadmap
      • Focus Area Job Roles
        • Cyber Defence Job Roles
        • Offensive Operations Job Roles
        • DFIR Job Roles
        • Cloud Job Roles
        • ICS Job Roles
        • Leadership Job Roles
      • NICE Framework
        • Security Provisionals
        • Operate and Maintain
        • Oversee and Govern
        • Protect and Defend
        • Analyze
        • Collect and Operate
        • Investigate
        • Industrial Control Systems
      • European Skills Framework
    • GIAC Certifications
    • Training Events & Summits
      • Events Overview
      • Event Locations
        • Asia
        • Australia & New Zealand
        • Latin America
        • Mainland Europe
        • Middle East & Africa
        • Scandinavia
        • United Kingdom & Ireland
        • United States & Canada
      • Summits
    • OnDemand
    • Get Started in Cyber
      • Overview
      • Degree and Certificate Programs
      • Scholarships
    • Cyber Ranges
  • Manage Your Team
    Manage Your Team

    Build a world-class cyber team with our workforce development programs

    • Overview
    • Why Work with SANS
    • Group Purchasing
    • Build Your Team
      • Team Development
      • Assessments
      • Private Training
      • Hire Cyber Professionals
      • By Industry
        • Health Care
        • Industrial Control Systems Security
        • Military
    • Leadership Training
  • Security Awareness
    Security Awareness

    Increase your staff’s cyber awareness, help them change their behaviors, and reduce your organizational risk

    • Overview
    • Products & Services
      • Security Awareness Training
        • EndUser Training
        • Phishing Platform
      • Specialized
        • Developer Training
        • ICS Engineer Training
        • NERC CIP Training
        • IT Administrator
      • Risk Assessments
        • Knowledge Assessment
        • Culture Assessment
        • Behavioral Risk Assessment
    • OUCH! Newsletter
    • Career Development
      • Overview
      • Training & Courses
      • Professional Credential
    • Blog
    • Partners
    • Reports & Case Studies
  • Resources
    Resources

    Enhance your skills with access to thousands of free resources, 150+ instructor-developed tools, and the latest cybersecurity news and analysis

    • Overview
    • Webcasts
    • Free Cybersecurity Events
      • Free Events Overview
      • Summits
      • Solutions Forums
      • Community Nights
    • Content
      • Newsletters
        • NewsBites
        • @RISK
        • OUCH! Newsletter
      • Blog
      • Podcasts
      • Summit Presentations
      • Posters & Cheat Sheets
    • Research
      • White Papers
      • Security Policies
    • Tools
    • Focus Areas
      • Cyber Defense
      • Cloud Security
      • Digital Forensics & Incident Response
      • Industrial Control Systems
      • Cyber Security Leadership
      • Offensive Operations
  • Get Involved
    Get Involved

    Help keep the cyber community one step ahead of threats. Join the SANS community or begin your journey of becoming a SANS Certified Instructor today.

    • Overview
    • Join the Community
    • Work Study
    • Teach for SANS
    • CISO Network
    • Partnerships
    • Sponsorship Opportunities
  • About
    About

    Learn more about how SANS empowers and educates current and future cybersecurity practitioners with knowledge and skills

    • SANS
      • Overview
      • Our Founder
      • Awards
    • Instructors
      • Our Instructors
      • Full Instructor List
    • Mission
      • Our Mission
      • Diversity
      • Scholarships
    • Contact
      • Contact Customer Service
      • Contact Sales
      • Press & Media Enquiries
    • Frequent Asked Questions
    • Customer Reviews
    • Press
    • Careers
  • Contact Sales
  • SANS Sites
    • GIAC Security Certifications
    • Internet Storm Center
    • SANS Technology Institute
    • Security Awareness Training
  • Search
  • Log In
  • Join
    • 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
Croatia (Local Name: Hrvatska)
Curacao
Cyprus
Czech Republic
Democratic Republic of the Congo
Djibouti
Dominica
Dominican Republic
East Timor
East Timor
Ecuador
Egypt
El Salvador
Equatorial Guinea
Eritrea
Estonia
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
Macedonia
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
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
Swaziland
Sweden
Switzerland
Taiwan
Tajikistan
Tanzania
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
Venezuela
Vietnam
Virgin Islands (British)
Virgin Islands (U.S.)
Wallis And Futuna Islands
Western Sahara
Yemen
Yugoslavia
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 and Incident Response

Related Content

Blog
N2C_Blog_Image.png
Penetration Testing and Red Teaming, Cyber Defense, Cybersecurity and IT Essentials, Open-Source Intelligence (OSINT), Red Team Operations, Incident Response & Threat Hunting, Operating System & Device In-Depth, Community, Digital Forensics and Incident Response, Job Hunting, Mentorship, NetWars, Imposter Syndrome, Offensive Operations
March 14, 2023
A Visual Summary of SANS New2Cyber Summit 2023
Check out these graphic recordings created in real-time throughout the event for SANS New2Cyber Summit 2023
370x370-person-placeholder.png
Alison Kim
read more
Blog
Google.png
Digital Forensics and Incident Response, Cloud Security
March 13, 2023
Google Cloud Log Extraction
In this blog post, we review the methods through which we can extract logs from Google Cloud.
Megan_Roddie_370x370.png
Megan Roddie
read more
Blog
Untitled_design-43.png
Digital Forensics and Incident Response, Cybersecurity and IT Essentials, Industrial Control Systems Security, Purple Team, Open-Source Intelligence (OSINT), Penetration Testing and Red Teaming, Cyber Defense, Cloud Security, Security Management, Legal, and Audit
December 8, 2021
Good News: SANS Virtual Summits Will Remain FREE for the Community in 2022
They’re virtual. They’re global. They’re free.
370x370-person-placeholder.png
Emily Blades
read more
  • Register to Learn
  • Courses
  • Certifications
  • Degree Programs
  • Cyber Ranges
  • Job Tools
  • Security Policy Project
  • Posters & Cheat Sheets
  • White Papers
  • Focus Areas
  • Cyber Defense
  • Cloud Security
  • Cybersecurity Leadership
  • Digital Forensics
  • Industrial Control Systems
  • Offensive Operations
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
Croatia (Local Name: Hrvatska)
Curacao
Cyprus
Czech Republic
Democratic Republic of the Congo
Djibouti
Dominica
Dominican Republic
East Timor
East Timor
Ecuador
Egypt
El Salvador
Equatorial Guinea
Eritrea
Estonia
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
Macedonia
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
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
Swaziland
Sweden
Switzerland
Taiwan
Tajikistan
Tanzania
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
Venezuela
Vietnam
Virgin Islands (British)
Virgin Islands (U.S.)
Wallis And Futuna Islands
Western Sahara
Yemen
Yugoslavia
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.
  • © 2023 SANS™ Institute
  • Privacy Policy
  • Contact
  • Careers
  • Twitter
  • Facebook
  • Youtube
  • LinkedIn