When on a pen test, you’re going to get password hashes. It’s going to happen. Something that I like to see is where the credentials we have may also be used throughout the rest of the target network. There’s a couple different tools that you can use to rapidly check system hashes across an IP range, and I try to detail some of them below.
Note: THIS IS GOING TO GENERATE A LOT OF NOISE! I can’t reiterate that obvious fact enough. If you’re trying to not get caught, you do NOT want to rapidly check whether a single hash works against a large IP range.
Metasploit has a module for verifying that the OS hash you’re specifying is valid for one or more IP addresses. It’s the auxiliary/scanner/smb/smb_login module, and definitely worth checking out. Armitage and Cobalt Strike both invoke this module when performing a “Check all creds” scan within their respective tools.
After loading the smb_login module, you’ll want to configure your options, I’ve provided mine below:
When I attempt to use this module (and really, any password checking tool listed here), I try to be as target as possible, so I typically disable the blank password check and the username as password option (unless either is actually the username and password). The reason I do this is because I’m testing a hash I already have obtained from another machine, not attempting to performing an online brute force attack.
After configuring the module with all the options it needs, you should run it and see something similar to the following (hopefully):
Hydra is probably among one of the most popular online password attacking tools out there today. It supports a large number of protocols, and what’s awesome is that Hydra does support checking windows hashes! To do this, we need to provide the user account we’re checking with the “-l” switch, provide the password hash with the “-p” switch, and the IP of the machine that we want to check (or a file with a list of IP addresses that we are attempting to check against). We also need to provide a couple options with the “-m” switch, specifically that we are checking a local account (or you can tell it to check a domain account) and that we’re providing a hash vs. a cleartext password. Finally, we tell Hydra the protocol that we want to target, and in this case, it’s smb.
When it’s all said and done, your console should look similar to the following:
Medusa is another tool that can be utilized to check Windows hashes against a large range of IP addresses. In this example, we’ll create files to store everything that we need to pass into Medusa. The “-H” switch is going to contain the list of IPs that we want to check, the “-C” switch is a file that contains our username and password hash we are checking, the “-M” switch tells medusa the protocol that we want to check, and the “-m” switch informs Medusa that we’re going to be checking with a password hash vs. a cleartext password.
Our password hash file should be in the following format:
Your console should look similar to the following:
One thing you could do is pipe the output into grep and just search for the “SUCCESS” string, and as you’re running your hash check, you’ll receive all the systems you are able to successfully log into.
Note: Upon being nearly completed with this article, a friend sent me another already published article on testing the speeds of online password tools, which can be viewed here.