Password hashes can be stolen in many ways, 2
for example via SQL injection attacks on a website 3
that extracts the hashes from the data base. 4
A SQL injection attack happens when a website 5
does not validate the input of the data it receives, 6
and because of that, 7
you can send direct queries 8
to the data base and ask it, 9
“Would you mind very much 10
just to give me your password hashes?”, 11
in the worst case scenario. 12
And here, what you can see here is a website 13
that has a collection of hashdumps from compromised websites. 14
You can see LinkedIn, EHarmony, the dating website. 15
These are the hashing algorithms they use, 16
MD5, not very good, should not have used it; 17
SHA1, also not acceptable. 18
So you can see, even big sites doing it wrong. 19
And then you’ve got an analysis here, 20
so we can check that out. 21
I’m going to go down here 22
and you can see here, 23
based on this analysis, 24
you feed into your cracking process. 25
You can see here 26
there’s a significant amount that uses the word LinkedIn, 27
so you would feed that into your rules. 28
And the rest of this sort of information, 29
like the Length, the Character sets used, 30
Character set frequency, etc., 31
that all goes back into your recracking of the hashes. 32
Hashes can also be extracted from operating systems. 33
If you have local access to the drive, 34
you can do that by mounting the hard drive 35
in another operating system, 36
or using a live CD, 37
as long as it can mount the file system. 38
And here we have the example of Windows. 39
We’ve got LM hashes, we’ve got NT hash, 40
NTLM hashes for the passwords of these users here. 41
And in Windows, these are stored 42
in something called the Security Account Manager 43
or SAM, which is essentially just a file. 44
And those hashes 45
can be extracted with various tools. 46
Here’s an example of one, PWDUMP7, 47
and you can see it here 48
literally dumping the usernames and hashes, 49
and the hashes are then put into cracking tools, 50
which I’m going to show you in a second. 51
Because offline attacks are not interacting with the cryptosystem, 52
they can't defend themselves, hashes can't defend themselves, 53
they’re just a bunch of characters in a file. 54
So the attack can be many, 55
many, many times faster than online attacks. 56
So think about 57
in the region of one hundred billion guesses per second 58
or maybe one hundred trillion guesses per second 59
with super multi GPU crackers 60
like the one you can see here. 61
And it’s this speed which enables 62
brute force hybrid and custom attacks 63
that we have gone through to work 64
with moderately complex passwords. 65
In Kali you’ll see that there are actually lots of cracking tools. 66
We go down to here, Password Attacks; 67
got Hashcat, John the Ripper, 68
Ophcrack, there’s wordlists or dictionaries there, 69
and there’s other tools beside these as well. 70
Let me introduce you to Hashcat. 71
So we need some hashes in order to crack first, 72
so I’ve downloaded some public hashes 73
from one of the old crack sites 74
that I’ve just chosen at random. 75
And this is the file here, hashes.txt, 76
so I will just (00:03:15 – inaudible) that so you can see it. 77
So there you go, 78
you can see all of the hashes there. 79
Stop that for a minute. 80
So we’re going to crack these 81
and work out what the password is 82
for each of these hashes. 83
Sometimes you won't know 84
what sort of hash or key derivation, 85
combination that you have, 86
so you can try using hashid with a hash 87
and see what sort of results you get. 88
And we can see here 89
that this is possibly a number of different hashes, 90
but I actually know that this is MD5. 91
We’re going to use a wordlist or dictionary attack 92
as part of a kind of hybrid attack, 93
so here’s our dictionary, 94
this is what this looks like. 95
See, lots of common words that people use for passwords, 96
you can see, it’s not actually that big. 97
And here’s a command, 98
we’re going to use “hashcat” with “-m” 99
is to tell it that it’s MD5. 100
Those are the hashes, that's the wordlist, 101
and that’s just simply the output file. 102
Let's give it a go, see what we get. 103
So the wordlist has successfully cracked 104
22,000 out of five hundred odd thousand hashes, 105
that’s about 4%, 106
and that was literally in a few seconds 107
with a dictionary attack. 108
And here we are, 109
same command, but with “-a 1”, 110
1 for Hashcat is a combination attack. 111
Press "S” for status, 112
we can see it there cracking more files. 113
So click there. 114
Remember this file here, 115
this is how we can potentially add rules, 116
so we can take our dictionary without input words 117
and then change them to other words. 118
So here, this would do nothing, if we had that as a rule, 119
that’d be lowercase; we can append characters, 120
we can duplicate the word; password, password. 121
So I’ve got a rules file here, 122
so I’ve just added these, 123
so we’ve got some appending of characters at the end, 124
we’ve got "f” a duplicate word reverse, 125
and “;” for “do nothing”. 126
So let's save that, 127
and we append to the end here, 128
our “- - rules”, 129
and then our rules file. 130
Let's give that a go. 131
And you can see, 132
in literally just a few seconds, 133
went from 22,000 to 23,000. 134
So that gives you a flavor 135
of the sort of process that you go through 136
when you’re doing password cracking. 137
And because these were MD5, 138
these are much, much faster to crack, 139
and they would be if they’d use 140
a key stretching function. 141
You can even try decrypting online, 142
and there are a number of sites 143
that can enable you to do that. 144
Check out this link, 145
it provides a bunch of sites who enable you to do that. 146
The big one is actually crackstation.net. 147
An online cracking is actually very viable 148
because it’s fast and easy to hire 149
for short periods of time, 150
massively powerful servers. 151
For example, with AWS Amazon you can rent 152
these for short periods of time to crack passwords, 153
which is what people do. 154
It’s a time cost exercise. 155
But if the right hash key derivation function, 156
key length and password is being chosen, 157
then it’s unlikely to be cracked even with all the power. 158
But sometimes you don't always have to crack the hash. 159
You can capture it and relay it in a relay attack. 160
If you’re a man in the middle, instead of cracking it, 161
you just forward it on, 162
after you have captured it, 163
enabling your access to the destination. 164
Famously, Windows LM or NTLM hashes 165
can be relayed due to an authentication flaw, 166
which can be done with Metasploit in Kali.