CVE-2024-3400: PAN-OS Command Injection Vulnerability in GlobalProtect Gateway. Learn More

CVE-2024-3400: PAN-OS Command Injection Vulnerability in GlobalProtect Gateway. Learn More

Services
Capture
Managed Detection & Response

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

twi-managed-portal-color
Co-Managed SOC (SIEM)

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

twi-briefcase-color-svg
Advisory & Diagnostics

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

tw-laptop-data
Penetration Testing

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

twi-database-color-svg
Database Security

Prevent unauthorized access and exceed compliance requirements.

twi-email-color-svg
Email Security

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

tw-officer
Digital Forensics & Incident Response

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

tw-network
Firewall & Technology Management

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

Solutions
BY TOPIC
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
Partners
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:

HKLM\SAM\SAM\Domains\Account\Users\<userkey>\UserPasswordHint

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:

12123_dadc522f-d339-4fd7-a52d-1b2264ff43bf

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:

11340_b404953c-6008-421e-b944-52cf5c2c4ac3

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

BSL_9238_4f890d11-5a85-4271-aad2-c7262598093a

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:

10033_77e63b77-e06d-454c-9fb6-f2861fe81760

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

Fake Dialog Boxes to Make Malware More Convincing

Let’s explore how SpiderLabs created and incorporated user prompts, specifically Windows dialog boxes into its malware loader to make it more convincing to phishing targets during a Red Team...

Read More

The Secret Cipher: Modern Data Loss Prevention Solutions

This is Part 7 in my ongoing project to cover 30 cybersecurity topics in 30 weekly blog posts. The full series can be found here. Far too many organizations place Data Loss Prevention (DLP) and Data...

Read More

CVE-2024-3400: PAN-OS Command Injection Vulnerability in GlobalProtect Gateway

Overview A command injection vulnerability has been discovered in the GlobalProtect feature within Palo Alto Networks PAN-OS software for specific versions that have distinct feature configurations...

Read More