Kali 105
Kali 105
Kali 105
Granted, these are Windows LM Hashes and not the more secure Windows 7/ Server 2008 NTLM
based hashes.
But, I believe that with cracking speeds increasing, relying on passwords alone may no longer be a
good security measure. Many companies and government facilities are moving away from using just
passwords alone to using dual authentication methods.
Biometrics and smartcards are really becoming popular in secure facilities.
Conclusion
In this section we learned that computers do not store passwords in plain text in the system ’ s
security database. The password is encrypted in some way and the resulting encrypted hash is
recorded.
We also learned that the Windows LM hash is not very secure and can be cracked very easily by
using a simple lookup table or “Rainbow table” as it is sometimes called.
If the LM hash cannot be found in one of the online databases, then a cracking program is needed.
You can turn off LM hashing, but security researchers have found that many networked systems and
programs still use them (even when turned off!) for backward compatibility.
Chapter 17 – Pass the Hash
Introduction
In the previous section we looked at how insecure Windows LM based passwords can be, but what
about NTLM based Passwords?
Windows systems usually store the NTLM hash right along with LM hash, the NTLM hash being more
secure. And as I mentioned, the LM hash can be turned off (or just use passwords longer than 14
characters). But what a lot of people have asked me is how much longer would it take to access the
user account, if only the NTLM hash was available?
This is a great question, and the answer is, if certain circumstances are met and a certain technique is
used, it could take the same amount of time.
Let me explain, if you can retrieve the LM or NT hashes from a computer, you do not need to crack
them. There is really no need. Sometimes you can simply take the hash as-is and use it as a token to
access the system. This technique is called “Pass the Hash”.
The Pass the Hash attack is not new, at the ever popular “BlackHat USA” conference last year there
was a presentation called, “Still Passing the Hash 15 Years Later”. That should give you some idea
how long this attack has been used.
Though some of these attacks no longer work on updated systems. AV and patched Windows systems
are catching some of the mechanisms used and blocking them. And networks set to use NTLM2 or
Kerberos only defeat these kinds of attacks.
Also the Windows User Account Control feature in Windows 7 blocks a lot of pass the hash type
attacks that still work against Windows XP systems. But if UAC is disabled, as we will see later in
this section, it could still work.
But it is still worth a look at some of the Pash the Hash techniques.
Good, the user Ralf was an administrator and the Bypass UAC function worked. It also dropped us
automatically into session 2. Now we can just run the “getsystem” command to get system level
credentials:
As shown above, using the “getuid” command again we verify that we are indeed the user “System”.
Now just type “hashdump” to recover the system hashes:
This will list the password hints and more importantly, the password hashes:
Administrator:500:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
Fred:1000:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
Alice:1001:aad3b435b51404eeaad3b435b51404ee:2e4dbf83aa056289935daea328977b20:::
Bob:1002:aad3b435b51404eeaad3b435b51404ee:d6e0a7e89da72150d1152563f5b89dbe:::
George:1003:aad3b435b51404eeaad3b435b51404ee:317a96a1018609c20b4ccb69718ad6e7:::
Ralf:1004:aad3b435b51404eeaad3b435b51404ee:2e520e18228ad8ea4060017234af43b2:::
As you can see we have the hashes for all of the users. Let’s see if we can connect to the Windows 7
system as the user Administrator.
We will use the SMB Psexc module to do this.
1. Background the current session and type “use exploit/windows/smb/psexec”:
If you want to see the options for this or any exploit remember you can “show options”.
2. Type, “show options”:
Alright, now we just need to set the IP address for the remote host (RHOST), the user name as
SMPUser and use the hash as SMBPass.
3. Type “set RHOST <TargetIPNumber>” and hit enter.
4. Then type “set SMBUser Alice”:
Okay we have the target system IP address set, and we have the user Alice selected. We just need to
set the SMB password. This is where the magic starts. Instead of putting in a password, which we
don’t know, we can just use the password hash!
5. Type “set SMBPass” and copy and paste in her password hash, then press enter:
(Paste in the entire hash as shown above. Leave out the user ID part of the user account a
“1001:” in this case, and leave off the trailing three “:”’s at the end.)
And the results?
On an updated Windows 7 system with the UAC set to any level other than off, nothing happens! You
get an Access Denied error message and no connection:
But on a system that has UAC turned completely off, it is a different story:
This is what happens in real life sometimes when testing security. What seems to be an opening just
may not work. So you back up and try something else. In this case we were not able to get a shell with
UAC enabled, but got it without problem with a system with UAC disabled.
You can use the commands to do some pretty interesting things. We are not going to cover the
command, but many of them may look similar to Windows users.
Just use the help switch (--help) and you will get a help list of command options and uses:
Though it is a bit beyond the scope of this book, the author of Pass the Hash Toolkit has some great
write-ups on his site, including one on how to use the Pass the Hash WMIS command and Powershell
to get a remote shell.
(http://passing-the-hash.blogspot.com/2013/07/WMIS-PowerSploit-Shells.html)
As seen below:
And it works very well as you can see a remote session was created with the user (Alice) and
password hash that was provided:
We need to load in the mimikatz module, there is a 32 and 64 bit module, choose accordingly. For
this section we will be using the 32 bit.
And there you go - a list of the password hashes. Well, we could grab the hash and try to crack it, or
run it through an online rainbow table, but what if we don’t have that kind of time?
It would be nice just to get the password in plain text.
Well, if the user has logged into the system, you can.
2. Type “Kerberos”: