WEBVTT

00:00.000 --> 00:01.680
running the password village.

00:01.680 --> 00:08.720
We wanted to start off getting you up and running with Hashcat on an NVIDIA GPU and then cover some basic attacks.

00:08.720 --> 00:15.660
The goal here is to start building a foundation that other talks throughout the village and DEF CON will expand on.

00:16.120 --> 00:21.700
So ideally you're going to have a GTX model NVIDIA card and be running Linux.

00:21.700 --> 00:34.440
The box we're on here is an AWS instance running the stock Ubuntu 20.04 AMI, and it has a Tesla T4, which isn't the greatest card for cracking, but it's going to work for our purposes.

00:35.360 --> 00:38.220
So Hashcat supports two modes of operation.

00:38.220 --> 00:47.640
You have OpenCL, which is a standard language, meaning that it's going to run on any card or CPU that supports OpenCL.

00:47.740 --> 00:54.820
That can be Intel, that can be AMD, that can be NVIDIA, and that can be AMD video cards.

00:56.580 --> 01:07.200
And then there's CUDA, which is specific to NVIDIA, which will allow us to eek just a bit more performance out of the card and get us some faster crack rates.

01:07.200 --> 01:12.400
Since we have an NVIDIA card on this box, we're going to go with the CUDA driver.

01:12.560 --> 01:14.860
Now we don't want to use the repo drivers.

01:15.120 --> 01:37.620
We don't want to use the repo drivers because the Ubuntu maintainers will include patches to those drivers that may fix a bug for a desktop environment, for instance, but it breaks the compatibility with the CUDA runtime and therefore breaks Hashcat.

01:37.620 --> 01:39.560
And we don't want that to happen.

01:39.560 --> 01:47.940
So we're going to use the driver that's supplied by NVIDIA, and we're going to use the CUDA toolkit version.

01:47.980 --> 01:55.340
So we are on Linux, we're on x86-64, so 64-bit processor or 64-bit system.

01:55.340 --> 01:56.840
We're running Ubuntu.

01:56.840 --> 01:59.360
We're running version 20.04.

01:59.380 --> 02:01.000
And then we have a couple of options here.

02:01.000 --> 02:13.280
So we have a run file, which is a local install, a local Debian install, which will create a Debian archive on your, or sorry, a Debian repo on your local box, and then you have the network install.

02:13.640 --> 02:28.820
Because we want to maintain compatibility between the CUDA version and the Hashcat release, we don't want to upgrade CUDA as part of a system upgrade on accident and break it.

02:28.820 --> 02:31.400
So we're going to go with the local run file.

02:31.940 --> 02:40.590
So we're going to copy this wget line here, paste that in.

02:47.680 --> 02:52.400
And then we're going to go ahead and grab our Hashcat binaries.

03:01.010 --> 03:07.730
And we're also want the PGP signature so that we can verify that it's legit.

03:13.580 --> 03:17.140
And then we're going to want to grab the Hashcat key.

03:17.140 --> 03:19.980
So we see here, we've got the fingerprint.

03:20.280 --> 03:22.260
Scroll over here a bit.

03:22.380 --> 03:27.480
So we've got the fingerprint here, and it says that it is on the PGP key servers.

03:27.480 --> 03:33.180
So we can use GPG to go ahead and import that key.

03:38.310 --> 03:40.450
Okay, we've got our key.

03:41.210 --> 03:48.750
And then let's verify that our download is actually signed and correct.

03:51.840 --> 03:55.700
Okay, so there we go, we've got a good signature.

03:57.880 --> 03:59.540
So we are good there.

04:00.340 --> 04:03.400
So we're also going to grab a word list.

04:04.020 --> 04:06.480
And we're going to grab that from Skull Security.

04:06.620 --> 04:13.640
And we're going to be using Rocky, which is kind of an old list, but it's also still really good.

04:15.720 --> 04:17.860
So let's grab that guy.

04:25.800 --> 04:28.300
Let's grab it incredibly slowly.

04:36.390 --> 04:40.330
So the next part, we'll go ahead and install the CUDA SDK.

04:40.330 --> 04:53.690
And it's going to fail the first time we run it, because we're on a brand new box that has no dependencies installed at all.

04:53.810 --> 05:06.350
So there are some things that the SDK is going to do, like build the NVIDIA driver, and it's going to need to have things like GCC and other libraries that it requires in order to do that.

05:06.430 --> 05:13.310
So what we're actually going to do is kind of walk through the steps on how we can make sure that we get all of those.

05:15.090 --> 05:21.090
Now that that's done, so we're going to do a search for an Aptcache search for the NVIDIA driver.

05:21.770 --> 05:24.430
And we can see that there are a bunch of them.

05:25.050 --> 05:28.970
So let's just say this guy right here.

05:29.310 --> 05:33.870
And it's the latest release that seems that Ubuntu has.

05:33.870 --> 05:43.030
And then we are going to apt-get build-dep NVIDIA driver 440.

05:43.030 --> 05:48.370
So we want to get all the dependencies that NVIDIA driver 440 requires.

05:50.090 --> 05:59.170
So we don't have any source listings for non-binary polls in our apt-config.

05:59.170 --> 06:02.950
So let's go ahead and make that happen.

06:10.520 --> 06:13.280
Make sure we get the editor in there as well.

06:16.500 --> 06:22.100
So we're going to uncomment this, and we're going to uncomment this and that's all we need.

06:25.480 --> 06:29.440
Do a quick update.

06:40.670 --> 06:42.370
And let's try that again.

06:44.170 --> 06:45.050
Okay.

06:46.270 --> 06:48.150
So we're going to go ahead and let all that install.

06:48.150 --> 06:51.530
So this will allow us to build our driver.

06:53.970 --> 07:00.270
We also need to grab one more thing because hashcat is packaged in the 7-zip format, we'll need to grab p7-zip.

07:17.610 --> 07:19.590
Any day now.

07:35.780 --> 07:36.840
AWS?

07:41.020 --> 07:42.500
Thank you.

07:49.940 --> 07:52.560
So we'll grab p7-zip as well.

07:56.400 --> 07:58.500
Hopefully that didn't take as long.

08:00.000 --> 08:05.240
And we're going to bypass some of this.

08:05.500 --> 08:12.940
So if you run the CUDA SDK installer, it has a kind of menu-driven interface.

08:12.940 --> 08:14.240
We don't want that.

08:14.420 --> 08:19.380
So we're going to run it in silent mode, and we want to install the driver and the toolkit.

08:23.720 --> 08:25.440
And this is going to take a minute.

08:26.700 --> 08:27.340
Okay.

08:27.680 --> 08:37.200
Now there's one other step that if we had used the menu-driven method, it would tell us that we need to add some stuff to our path.

08:37.720 --> 08:40.240
So if we look at

08:43.340 --> 08:52.620
ldsoconf.conf.d, so it already wrote our CUDA library path, so that's good.

08:52.980 --> 08:58.740
But it did not write the path update for our profile.

08:59.360 --> 09:02.120
So we need to go ahead and add that in.

09:02.280 --> 09:12.760
So we'll do a sudo vi slash etc profile.d, and we'll call this cuda.sh.

09:14.920 --> 09:24.700
And then in here, we're basically just adding the path to the CUDA binaries to our system path.

09:24.700 --> 09:29.320
And then this is going to load every time a new instance is spawned.

09:29.320 --> 09:34.760
So we'll go ahead and source accept profile so we get the update.

09:39.400 --> 09:40.280
Okay.

09:40.280 --> 09:46.880
And then we also need to run ldconfig so that it updates the library path.

09:49.110 --> 09:50.550
Okay.

09:50.670 --> 09:57.770
And then let's check NVIDIA SMI and make sure that it sees our card.

09:58.050 --> 09:59.270
And it does.

09:59.270 --> 10:08.850
So we've got our Tesla T4, and it is running on the driver version that was supplied with the CUDA SDK, which is 450.51.05.

10:08.850 --> 10:11.250
It's right here.

10:11.530 --> 10:14.210
And we can see we're on CUDA version 11.

10:14.310 --> 10:15.970
So that's good.

10:16.570 --> 10:20.630
So next, let's unpack Hashcat.

10:20.630 --> 10:25.590
So we're going to 7zip extract hashcat.7zip.

10:26.850 --> 10:33.110
And while we're at it, let's go ahead and bunzip to rocky.txt.

10:39.220 --> 10:40.980
All right.

10:41.980 --> 10:45.800
So let's make sure that Hashcat sees our video card now.

10:49.160 --> 10:50.420
And it does.

10:50.420 --> 10:54.400
And it sees that it can run in either CUDA or OpenCL mode.

10:55.120 --> 10:58.240
It's going to default to the CUDA version here.

10:58.240 --> 11:03.220
So we don't need to worry about the OpenCL info below us.

11:03.480 --> 11:11.220
And then let's just do a quick benchmark to make sure that we actually get running.

11:12.700 --> 11:15.540
Okay, so we can see that it selected our device.

11:15.740 --> 11:21.280
It skipped the OpenCL part of that because it has the CUDA API.

11:21.500 --> 11:23.320
And there we go.

11:27.340 --> 11:33.180
So let's move into doing some simple attacks with Hashcat.

11:36.910 --> 11:41.430
So we're going to go back to the Password Village site, which is at passwordvillage.org.

11:42.010 --> 11:45.990
And we are going to grab some NT hashes.

11:47.750 --> 11:50.570
So we've got our Hashcat examples here.

11:52.210 --> 11:58.310
You can copy and paste these off the site and follow along if you are set up to do so.

11:59.830 --> 12:01.950
Let's get rid of this.

12:04.030 --> 12:06.610
We'll call this NT.hash.

12:08.910 --> 12:13.870
We'll paste those guys in using whatever editor you desire.

12:15.950 --> 12:24.050
And then we used Hashmode 1000 here because I know that 1000 is NTLM.

12:25.670 --> 12:32.290
But if you needed to find it, you could do a Hashcat help and then grep.

12:32.690 --> 12:39.090
We'll do a dash I so we do a case insensitive search and look for NTLM.

12:39.870 --> 12:43.450
And we can see right here NTLM is Mode 1000.

12:43.570 --> 12:47.670
Net NTLM V1 and V2 are different hash types.

12:47.670 --> 12:59.330
Typically, you see those coming out of Responder, which I believe EvilMog is going to do a talk on later in the day that will quickly cover those.

12:59.390 --> 13:05.290
So we want Hashcat TACM 1000 for Mode.

13:05.630 --> 13:08.190
We want our NT.hash file.

13:08.190 --> 13:10.730
And then we want to run this against RockYou.

13:16.800 --> 13:19.200
So it's going to initialize the device there.

13:19.200 --> 13:20.700
It's going to load the dictionary.

13:20.800 --> 13:23.920
And then it cracked all our hashes.

13:23.920 --> 13:28.320
It cracked all our hashes because these hashes were generated from RockYou.

13:28.340 --> 13:32.080
So you would expect to get all of those.

13:32.080 --> 13:48.480
If you were pulling hashes from the wild, you know, RockYou may crack one of them, it may crack none of them, or it may crack all of them, depending on how good the password policy of the company or the site that was compromised and the hashes were leaked from.

13:49.240 --> 13:52.760
So to kind of walk through this a little bit, there's a lot going on on the screen here.

13:52.760 --> 13:57.160
So we have our hashes up here and we have the associated plain text on the opposite side.

13:57.160 --> 14:06.120
So you've got, this is a hash, we've got a separator, and then we have the plain text of this hash.

14:06.620 --> 14:08.640
And then we've got 10 of those.

14:09.020 --> 14:11.040
So we had a session name of hashcat.

14:11.120 --> 14:20.740
If we were doing some session stuff where maybe we wanted to stop this and resume it later, this name is important.

14:20.740 --> 14:22.500
We're not going to cover that here.

14:22.680 --> 14:30.520
The status would normally be running, but since we only had a small sample and we knew the plain text for all of those, it cracked them all pretty quick.

14:30.900 --> 14:34.780
We were running against NTLMs.

14:35.580 --> 14:40.320
Our hash target was the hash file that we supplied called nt.hash.

14:40.760 --> 14:48.740
The guest base, meaning the candidate words that we were selecting from, came from a file called rockyou.txt.

14:49.240 --> 15:01.240
The speed of our device, which is actually pretty slow compared to what we saw up here in the benchmark, because it never got fully up to speed.

15:01.240 --> 15:02.460
Where are we at here?

15:07.860 --> 15:09.180
Right here.

15:11.440 --> 15:20.220
So we can see here we were going at about 35.7 billion.

15:21.280 --> 15:22.820
It's pretty quick.

15:23.060 --> 15:27.820
But down here we were only going at about 7.7 million.

15:27.820 --> 15:42.460
So that's mainly because we didn't have enough work to supply the GPU, but also because we cracked all the hashes so quickly that it never got a chance to get up to full speed.

15:42.840 --> 15:46.100
So we recovered all 10 of our hashes, so we had 10 digests.

15:46.100 --> 15:48.760
A hash is also called a digest.

15:49.100 --> 15:58.980
It ran through the entire list of words, so we had 14.3 million possible candidates, and we exhausted that entire space.

15:58.980 --> 16:05.180
It rejected none of them, and a rejection can come from a word that's too long.

16:05.180 --> 16:09.700
We had a restore point, which we didn't use because we're not doing a restore .

16:10.040 --> 16:12.260
And then we had the candidates down here.

16:12.260 --> 16:14.690
Now in a long run, this is going to show

16:17.930 --> 16:24.450
a sample of what words are currently being tried against the hashes.

16:24.450 --> 16:38.430
And here we have some hex representation, and this is probably because we have a colon, which is a separator that HashCat uses internally.

16:38.430 --> 16:46.490
So it's going to put that into a hex representation so that it doesn't accidentally cut your hash or your plain text in the wrong spot.

16:46.490 --> 16:51.370
And then we have our hardware monitor, which was telling us some statistics about the card.

16:51.370 --> 17:02.350
So it was running at 59 degrees Celsius, it was at 75% utilization, and then our core speed, the memory speed, and the bus workload.

17:04.010 --> 17:08.090
So that's a very simple dictionary attack.

17:09.050 --> 17:10.330
So let's try

17:17.020 --> 17:20.060
let's try doing a combinator attack.

17:20.060 --> 17:34.080
Now a combinator attack is when you take two word lists, and HashCat is going to take one word from one word list and one word from the other word list and smash them together and try that as a candidate.

17:34.080 --> 17:36.320
And it's going to do that for each one.

17:36.600 --> 17:46.720
So in very large runs, this is not really the best attack to do because it can take years to complete.

17:46.720 --> 17:58.880
So if we were to use Rocky with Rocky, for instance, we're doing 14.3 million to the 14.3 million, which ends up being some ridiculous number that we're probably never going to exhaust.

18:00.360 --> 18:08.480
The example dictionaries here are actually reasonably small and it's a really good baseline for showing how the attack works.

18:08.480 --> 18:12.320
So we can copy this.

18:15.160 --> 18:20.080
So we're going to use A1, which is the attack mode for combinator.

18:20.400 --> 18:23.820
These hashes are MD5, so we're going to say M0.

18:23.820 --> 18:27.560
M0 is the mode identifier for MD5.

18:28.020 --> 18:30.620
HashCat provides an example list of hashes.

18:30.620 --> 18:39.300
So this is going to be the list of MD5 hashes and then the two example dictionaries, which are actually the same dictionary, so we're just going to specify it twice.

18:39.300 --> 18:42.020
You could do this with two different dictionaries.

18:42.080 --> 18:50.620
So if you had example.dict and then example1.dict that has some different word set in it, that will work and you could even reverse some.

18:52.620 --> 18:54.920
So let's go ahead and run this.

18:56.500 --> 18:59.380
Go ahead and run this with the right name.

19:06.930 --> 19:09.330
And yeah, that's a lot.

19:09.530 --> 19:16.650
So we had, if we go back to our status output here, we know all this.

19:16.650 --> 19:22.770
We had a file which was example.dict on the left side and a file which was example.dict on the right side.

19:22.770 --> 19:33.330
So if you think about it this way, you have example.dict and then example.dict.

19:33.890 --> 19:49.370
So this is going to be the left side, this is going to be the right side, and then again, Hashcat just combined left and right, made a single word out of it, hashed it, and then checked it against the list of hashes.

19:50.070 --> 19:53.630
So we can see here that we went quite a bit faster this time.

19:53.630 --> 19:59.370
So we went at 5.8 billion candidates per second.

19:59.730 --> 20:13.810
We recovered 2,906 of 6,494 digests, so just under 45 percent, and we have 3,588 hashes remaining.

20:16.310 --> 20:17.970
So the next one we'll do

20:24.030 --> 20:25.990
is a brute force.

20:25.990 --> 20:34.170
Now, this is going to be a very simple example of a mask attack, we'll talk about mask attacks later.

20:34.970 --> 20:38.310
Brute forcing is when we take

20:42.230 --> 20:49.810
a string and then increment it by either a number or a letter to exhaust a full key space.

20:49.810 --> 21:08.530
So in this case, we're doing 1, 2, 3, let's see, 1, 2, 3, 4, 5, 6 spaces of all characters, so that's numbers, letters, lowercase and uppercase, and then specials.

21:09.050 --> 21:12.790
This is again going to be MD5.

21:12.870 --> 21:16.890
We're going to use the same example hash set that we used before.

21:17.370 --> 21:26.010
A3 is to specify a mask attack or a brute force attack, and then get this right the first time,

21:30.350 --> 21:33.070
and then we let it run.

21:33.330 --> 21:42.630
So you'll see here that we're only going to crack six-character passwords because we only specified for HashCat to crack six-character passwords.

21:43.250 --> 21:56.590
We can see we've got some lowercase, we had some numbers, now we've got an uppercase here, there's an uppercase there, some stuff starting with numbers, so lowercase.

21:58.230 --> 21:58.930
Okay.

22:00.630 --> 22:06.530
So what HashCat was doing in that mode was, so we had this mask specified.

22:07.370 --> 22:15.470
We said we want to try all possible combinations of all printable ASCII characters on a standard keyboard.

22:15.470 --> 22:17.510
So we have 95 of those.

22:17.550 --> 22:22.630
So for each one of these positions, it's going to try all 95 possibilities.

22:23.150 --> 22:50.270
So if we look at it this way, let's say it starts at 1, 2, 3, 4, 5, 6 As, and then it tries 1, 2, 3, 4, 5, 6 with a B, and then it tries 1, 2, 3, 4, 5 with a C, and it continues to increment until C gets to Z, and then it shifts by 1.

22:51.070 --> 23:01.770
So then we have 1, 2, 3, 4, B, A, 1, 2, 3, 4, B, B, and so on and so forth.

23:01.770 --> 23:11.270
But since we're going so fast, the incrementing of the characters goes ridiculously fast.

23:12.830 --> 23:21.590
So that is your basic rundown of the three very basic attack modes that HashCat does.

23:22.090 --> 23:39.710
You can go back and take a look at the standard attacks that are specified on the Password Village website if you need help understanding what was going on, and also some examples of how to use the commands for a given attack mode.

23:41.670 --> 23:46.710
So that's all we've got for now, and hope you join us for the next talk!

