Stamping Out Hash Corruption, Like a Boss
Have you ever dumped LM and NTLM password hashes from a Windows system using the registry and never been able to crack the hashes or pass the hash? If so, maybe this blog post will be of specific interest and/or importance to you.
A couple months ago, my good friend Ryan Reynolds of Crowe Horwath explained to me that often times he would extract password hashes from a Windows system via the Windows registry and the hashes would never crack. He also discovered that when he pulled password hashes using other techniques, like LSASS injection, that he would get entirely different hashes, which in fact did crack successfully.
Here is just one example Ryan found when extracting hashes from Metasploit (via SAM/SYSTEM) and Pwdump6 (via LSASS injection).
- Hash Extraction via Registry using Metasploit
- LM: 4500a2115ce8e23a99303f760ba6cc96
- NTLM: 5c0bd165cea577e98fa92308f996cf45
- Hash Extraction via Injection using Pwdump6
- LM: aad3b435b51404eeaad3b435b51404ee
- NTLM: 5f1bec25dd42d41183d0f450bf9b1d6b
After hearing a bit about this problem and knowing full well that we were getting bad hashes, Ryan and I decided that we would put our heads together and see if we could solve this problem.
Here are some highlights that resulted from our research:
- The corruption problem has been around since the late 90’s
- This has affected Penetration Testers, Forensic Investigators and anyone else extracting password hashes from Windows Systems during this time.
- Nearly all the registry extraction tools we tested, including the following were affected:
- Metasploit, Cain and Able, Pwdump, Fgdump, L0phtcrack, Samdump, Creddump, Pwdump5, Pwdump7 and others.
- This behavior was observed on the following Windows Operating Systems:
- Windows 2000, Windows XP, Windows 2003, Windows Vista, Windows 7, Windows 2008, Windows 8 Pre-Release and interim versions and service packs
- We discovered the source of this problem to be a logic flaw in how the registry information was being processed.
- We developed patches for tools that were open-source and are actively working with community developers to ensure that this problem is “Stamped Out”.
Here are the slides that we delivered at DEFCON 20 for your viewing pleasure:
Additionally, for those who don’t like power point slides and would prefer reading RFC-like docs, we developed a 15-page white paper that describes the process in uber detail for your reading pleasure.
This post would not be complete if we didn’t show you how this hash corruption stuff works. Below we have provided the demonstration video that we used in our DEFCON and BlackHat presentations that shows corrupted hash extraction on Windows 8 using Metasploit.
We hope that solving this problem for password cracking tools will help security professionals of all types obtain the correct password hashes from systems to evaluate their true state.
Here’s a quick status of where we currently are with our patching efforts at the time of this writing:
- Creddump - Fixed in Creddump Creddump v0.3
- Metasploit - Fixed in Metasploit since pull request #587 (7/15/12)
- L0phtcrack - Fixed in L0phtCrack v6.0.16
- Samdump2 - Fixed in Samdump v1.1.1 (fix pre-dates our research, but noting it anyways)
- Fgdump - Fix still in progress as SAM/SYSTEM variant of Fgdump is still BETA
- Cain and Able - Still awaiting response from Author
- Pwdump7 - Still awaiting response from Author
If you have experienced this problem in the course of your work (or perhaps with a different tool not listed above) and the result of this research has directly helped you, we would really like to hear from you by commenting on this post.
This was also posted on the SpiderLabs blog here.