Trustwave Unveils New Offerings to Maximize Value of Microsoft Security Investments. Learn More

Trustwave Unveils New Offerings to Maximize Value of Microsoft Security Investments. Learn More

Managed Detection & Response

Eliminate active threats with 24/7 threat detection, investigation, and response.

Co-Managed SOC (SIEM)

Maximize your SIEM investment, stop alert fatigue, and enhance your team with hybrid security operations support.

Advisory & Diagnostics

Advance your cybersecurity program and get expert guidance where you need it most.

Penetration Testing

Test your physical locations and IT infrastructure to shore up weaknesses before exploitation.

Database Security

Prevent unauthorized access and exceed compliance requirements.

Email Security

Stop email threats others miss and secure your organization against the #1 ransomware attack vector.

Digital Forensics & Incident Response

Prepare for the inevitable with 24/7 global breach response in-region and available on-site.

Firewall & Technology Management

Mitigate risk of a cyberattack with 24/7 incident and health monitoring and the latest threat intelligence.

Offensive Security
Solutions to maximize your security ROI
Microsoft Exchange Server Attacks
Stay protected against emerging threats
Rapidly Secure New Environments
Security for rapid response situations
Securing the Cloud
Safely navigate and stay protected
Securing the IoT Landscape
Test, monitor and secure network objects
Why Trustwave
About Us
Awards and Accolades
Trustwave SpiderLabs Team
Trustwave Fusion Security Operations Platform
Trustwave Security Colony
Technology Alliance Partners
Key alliances who align and support our ecosystem of security offerings
Trustwave PartnerOne Program
Join forces with Trustwave to protect against the most advance cybersecurity threats
SpiderLabs Blog

All Your Password Hints Are Belong to Us

This past weekend I ended up coming into the SpiderLabs office and "nerded out" with my good friend Ryan Reynolds to follow-up on the research we released at DEFCON and BlackHat this year. As some of you may already know, our research was focused on corruption of LM and NTLM password hashes when they were extracted from the Windows registry (specifically, the SAM) by many tools.

In the process of going through one our test cases on a Windows 8 machine on Saturday, we stumbled across a new key ("UserPasswordHint") that we had not seen before in the SAM database. To both of us, this seemed like a rather odd, but intriguing key that would be cool to explore a bit more "at some point".

Well… being the impatient weirdo that I am, I could not wait and dove in headfirst as soon as I got home that night. This blog post will cover some of the details on how to extract/decode User Password Hints from the Windows registry and how I extended Metasploit's Hashdump tools to incorporate this information.

Inside the Registry Data

For starters, the "UserPasswordHint" key on Windows 8 (and Windows 7) is stored in the following location:


If you're running with SYSTEM access (you can use your imagination here), you can read this key easily by doing a reg query like so:


In first looking at the storage location here, I was a little disappointed thinking that the hint was encrypted in some way until I noticed the pattern of zeros. Having dealt with a fair amount of PHP malware in the last couple months, one of things the "baddies" do is chunk up their payload data into individual characters and then encode them in their ASCII numerical representation. Well in looking at this registry value, it seemed to follow a similar approach, so I wrote a little decoder in Ruby to see if I could learn this users password hint.

Here is the decode method I whipped up to do this:


Now you can use the value stored for this user and translate it back to the clear-text hint, like so:


Although this stuff looked a bit unreadable on the surface we can now see that it can clearly be decoded and could be used by tools that extract information from the SAM. This seems like it would be very helpful for penetration testers by giving them more insight into what the user's password might be, so I decided to take it one step further.

Extending Metasploit's Hashdump Tools

In our recent hash corruption research, we ended up making a number of changes to the Metasploit Hashdump tools (hashdump.rb and smart_hashdump.rb) and became very familiar with how they work. As such, it just made sense to try integrating user password hint decoding with these tools so I sent a GitHub pull request on Sunday night to the Metasploit team to add this functionality.

Here is a preview of what these new additions will give users when dump hashes from a Meterpreter session:


As of yesterday, these password hint extraction features were merged into the Metasploit Project. I would like to extend a special thanks to @_sinn3r and @TheLightCosine for their ideas, de-turding and review of my code. Also, props to @_sinn3r for pointing out that Window XP also stores user password hints in another location in the registry in the decoded form (this was also included in the recent Metasploit improvements).

Parting Thoughts

I had a lot of fun with this little detour through the Windows Registry for a couple hours. If you use these tools and these new fangled hints help you out in some way, I would love to hear your story.

That is all for now. I hope to have more Windows Registry hijinks and other "hax" to talk about here in the near future, so please stay tuned.

Latest SpiderLabs Blogs

Fare Thee Well ModSecurity: End-of-Life and Last Commercial Rules Update for June 2024

A Fourteen-Year Journey Comes to an End In June 2010, Trustwave acquired Breach Security, which brought with it the popular Open-Source Web Application Firewall ModSecurity for Apache. At that time,...

Read More

Secure Access Service Edge: Another Multi-Tool for the SOC

Over the years, several security defense architectures have merged into a single solution. Endpoint detection tools can perform sophisticated detections and correlations that used to require a...

Read More

Search & Spoof: Abuse of Windows Search to Redirect to Malware

Trustwave SpiderLabs has detected a sophisticated malware campaign that leverages the Windows search functionality embedded in HTML code to deploy malware. We found the threat actors utilizing a...

Read More