WEBVTT

00:01.360 --> 00:07.740
This is PrivacyNotIncluded, one of your Password Village leads, and I want to welcome you to our first year running the Password Village.

00:07.740 --> 00:14.660
We wanted to start off getting you up and running with Hashcat on an NVIDIA GPU and then cover some basic attacks.

00:14.660 --> 00:21.740
The goal here is to start building a foundation that other talks throughout the village and DEF CON will expand on.

00:22.160 --> 00:27.920
So ideally you're going to have a GTX model NVIDIA card and be running Linux.

00:27.980 --> 00:40.560
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:41.460 --> 00:44.360
So Hashcat supports two modes of operation.

00:44.360 --> 00:53.760
You have OpenCL, which is a standard language, meaning that it's going to run on any card or CPU that supports OpenCL.

00:53.820 --> 01:00.960
That can be Intel, that can be AMD, that can be NVIDIA, and that can be AMD video cards.

01:02.720 --> 01:13.300
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:13.300 --> 01:18.500
Since we have an NVIDIA card on this box, we're going to go with the CUDA driver.

01:18.680 --> 01:20.980
Now we don't want to use the repo drivers.

01:21.180 --> 01:43.840
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:43.840 --> 01:45.700
And we don't want that to happen.

01:45.700 --> 01:54.020
So we're going to use the driver that's supplied by NVIDIA, and we're going to use the CUDA toolkit version.

01:54.220 --> 02:07.120
So we are on Linux, we're on x86-64, so 64-bit processor, our 64-bit system, we're running Ubuntu, we're running version 20.04, and then we have a couple of options here.

02:07.120 --> 02:19.320
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:19.880 --> 02:34.920
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:34.920 --> 02:37.540
So we're going to go with the local run file.

02:38.100 --> 02:46.690
So we're going to copy this wget line here, paste that in,

02:52.860 --> 02:58.620
and then we're going to go ahead and grab our Hashcat binaries,

03:06.030 --> 03:13.790
and we also want the PGP signature so that we can verify that it's legit.

03:20.040 --> 03:23.300
And then we're going to want to grab the Hashcat key.

03:23.300 --> 03:39.220
So we see here we've got the fingerprint, scroll over here a bit, so we've got the fingerprint here, and it says that it is on the PGP key servers, so we can use GPG to go ahead and import that key.

03:44.350 --> 03:55.230
Okay, now we've got our key, and then let's verify that our download is actually signed and correct.

03:57.860 --> 04:01.900
Okay, so there we go, we've got a good signature.

04:03.900 --> 04:05.780
So we are good there.

04:06.360 --> 04:19.700
So we're also going to grab a word list, and we're going to grab that from Skull Security, and we're going to be using Rocky, which is kind of an old list, but it's also still really good.

04:22.100 --> 04:23.880
So let's grab that guy.

04:32.030 --> 04:34.310
Let's grab it incredibly slowly.

04:42.610 --> 05:00.070
So the next part, we'll go ahead and install the CUDA SDK, 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.

05:00.190 --> 05:12.390
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:12.390 --> 05:22.790
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, now that that's done.

05:22.790 --> 05:30.610
So we're going to do a search for an Aptcache search for the NVIDIA driver, and we can see that there are a bunch of them.

05:31.130 --> 05:39.750
So let's just say this guy right here, and it's the latest release that it seems that Ubuntu has.

05:39.970 --> 05:49.170
And then we are going to apt-get build-dep NVIDIA driver 440.

05:49.170 --> 05:54.310
So we want to get all the dependencies that NVIDIA driver 440 requires.

05:56.330 --> 06:09.250
So we don't have any source listings for non-binary pulls in our our app config, so let's go ahead and make that happen.

06:16.410 --> 06:19.350
Let's make sure we get the editor in there as well.

06:22.390 --> 06:28.270
So we're going to uncomment this, and we're going to uncomment this, and that's all we need.

06:31.560 --> 06:37.560
Do a quick update,

06:46.900 --> 06:48.520
and let's try that again.

06:50.480 --> 06:57.680
Okay, so we're going to go ahead and let all of that install, so this will allow us to build our driver.

07:00.060 --> 07:01.720
Oh, we also need to grab one more thing.

07:01.720 --> 07:06.180
Because HashCat is packaged in the 7-zip format, we'll need to grab p7-zip.

07:23.940 --> 07:25.480
Any day now.

07:39.320 --> 07:40.200
Hello?

07:41.900 --> 07:42.780
AWS?

07:56.400 --> 07:58.480
So we'll grab p7-zip as well.

08:02.560 --> 08:04.420
Thankfully that didn't take as long.

08:06.240 --> 08:11.260
And we're going to bypass some of this.

08:11.420 --> 08:19.060
So if you run the CUDA SDK installer, it has a kind of menu-driven interface.

08:19.060 --> 08:20.480
We don't want that.

08:20.480 --> 08:25.620
So we're going to run it in silent mode, and we want to install the driver and the toolkit.

08:29.740 --> 08:31.680
And this is going to take a minute.

08:32.320 --> 08:42.820
Okay, 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:43.220 --> 08:45.580
So if we look at

08:51.120 --> 08:58.240
ldsoconf.conf.d... So it already wrote our CUDA library path, so that's good.

08:58.680 --> 09:04.200
But it did not write the path update for our profile.

09:05.240 --> 09:07.500
So we need to go ahead and add that in.

09:07.500 --> 09:18.440
So we'll do a sudo vi slash etc profile.d and we'll call this cuda.sh.

09:20.920 --> 09:29.880
And then in here, we're basically just adding the path to the CUDA binaries to our system path.

09:29.940 --> 09:35.240
And then this is going to load every time a new instance is spawned.

09:35.240 --> 09:40.300
So we'll go ahead and source except profile so we get the update.

09:45.230 --> 09:52.390
Okay, and then we also need to run ldconfig so that it updates the library path.

09:54.820 --> 10:03.480
Okay, and then let's check NVIDIA SMI and make sure that it sees our card.

10:03.500 --> 10:04.580
And it does.

10:04.580 --> 10:14.520
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:14.520 --> 10:16.920
It's right here.

10:17.240 --> 10:19.860
And we can see we're on CUDA version 11.

10:20.120 --> 10:21.620
So that's good.

10:22.240 --> 10:26.460
So next, let's unpack Hashcat.

10:26.560 --> 10:31.340
So we're gonna 7-zip extract hashcat.7zip.

10:32.600 --> 10:38.740
And while we're at it, let's go ahead and bunzip to rocky.txt.

10:44.940 --> 10:46.440
All right.

10:48.120 --> 10:51.380
So let's make sure that Hashcat sees our video card now.

10:54.910 --> 10:56.070
And it does.

10:56.070 --> 11:00.390
And it sees that it can run in either CUDA or OpenCL mode.

11:00.530 --> 11:08.810
It's going to default to the CUDA version here, so we don't need to worry about the OpenCL info below us.

11:09.290 --> 11:16.970
And then let's just do a quick benchmark to make sure that we actually get running.

11:17.870 --> 11:21.210
Okay, so we can see that it selected our device.

11:21.210 --> 11:27.010
It skipped the OpenCL part of that because it has the CUDA API.

11:27.270 --> 11:29.310
And there we go.

11:32.550 --> 11:38.890
So let's move into doing some simple attacks with Hashcat.

11:42.570 --> 11:51.630
So we're going to go back to the Password Village site, which is at passwordvillage.org, and we're going to grab some NT hashes.

11:53.410 --> 11:56.250
So we've got our Hashcat examples here.

11:57.870 --> 12:04.450
You can copy and paste these off the site and follow along if you are set up to do so.

12:05.350 --> 12:07.370
Actually, let's get rid of this.

12:09.310 --> 12:12.230
And we'll call this nt.hash.

12:14.620 --> 12:19.460
We'll paste those guys in using whatever editor you desire.

12:21.360 --> 12:29.340
And then we used Hashmode1000 here because I know that 1000 is NTLM.

12:31.120 --> 12:38.120
But if you needed to find it, you could do a Hashcat help and then grep.

12:38.220 --> 12:45.100
We'll do a dash i so we do a case insensitive search and look for NTLM.

12:45.120 --> 12:49.280
And we can see right here NTLM is Mode1000.

12:49.480 --> 12:53.320
NetNTLM v1 and v2 are different hash types.

12:53.320 --> 13:04.840
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.

13:04.840 --> 13:11.020
So we want Hashcat.tacm1000 for mode.

13:11.240 --> 13:16.400
We want our nt.hash file and then we want to run this against RockView.

13:22.420 --> 13:24.860
So it's going to initialize the device there.

13:24.860 --> 13:29.580
It's going to load the dictionary and then it cracked all our hashes.

13:29.580 --> 13:34.120
It cracked all our hashes because these hashes were generated from RockView.

13:34.120 --> 13:37.680
So you would expect to to get all of those.

13:37.680 --> 13:54.120
If you were pulling hashes from the wild, you know, RockView 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 the company or the site that was compromised and the hashes were leaked from.

13:55.040 --> 13:58.440
So to kind of walk through this a little bit, there's a lot going on on the screen here.

13:58.440 --> 14:02.780
So we have our hashes up here and we have the associated plain text on the opposite side.

14:02.780 --> 14:11.780
So you've got this is a hash, we've got a separator, and then we have the plain text of this hash.

14:12.280 --> 14:14.320
And then we've got 10 of those.

14:14.700 --> 14:16.720
So we had a session name of HashCat.

14:16.780 --> 14:26.400
If we were doing some session stuff where maybe we wanted to stop this and resume it later, this name is important.

14:26.400 --> 14:28.160
We're not going to cover that here.

14:28.340 --> 14:36.120
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:36.480 --> 14:40.520
We were running against NTLMs.

14:41.280 --> 14:46.000
Our hash target was the hash file that we supplied called nt.hash.

14:46.360 --> 14:54.460
The guest base, meaning the candidate words that we were selecting from, came from a file called rocky.txt.

14:54.840 --> 15:06.920
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:06.920 --> 15:08.120
Where are we at here?

15:17.420 --> 15:19.500
So we can see here we were going at about

15:24.080 --> 15:26.000
35.7 billion.

15:26.940 --> 15:28.520
It's pretty quick.

15:28.720 --> 15:33.540
But down here we were only going at about 7.7 million.

15:33.540 --> 15:48.080
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:48.520 --> 15:51.760
So we recovered all 10 of our hashes, so we had 10 digests.

15:51.760 --> 15:54.380
A hash is also called a digest.

15:54.800 --> 16:04.780
It ran through the entire list of words, so we had 14.3 million possible candidates, and we exhausted that entire space.

16:04.800 --> 16:10.820
It rejected none of them, and a rejection can come from a word that's too long.

16:10.820 --> 16:15.360
We had a restore point, which we didn't use because we're not doing a restore.

16:15.600 --> 16:17.900
And then we had the candidates down here.

16:17.900 --> 16:20.560
Now in a long run, this is going to show

16:23.600 --> 16:30.080
a sample of what words are currently being tried against the hashes.

16:30.080 --> 16:44.020
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:44.020 --> 16:52.140
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:52.140 --> 16:57.040
And then we have our hardware monitor, which was telling us some statistics about the card.

16:57.040 --> 17:07.960
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:10.040 --> 17:13.720
So that's a very simple dictionary attack.

17:14.720 --> 17:15.960
So let's try

17:21.170 --> 17:25.470
doing a combinator attack.

17:25.470 --> 17:39.790
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:39.790 --> 17:41.930
And it's going to do that for each one.

17:41.930 --> 17:52.310
So in very large runs, this is not really the best attack to do because it can take years to complete.

17:52.310 --> 18:04.730
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:06.010 --> 18:14.250
The example dictionaries here are actually reasonably small and it's a really good baseline for showing how the attack works.

18:14.250 --> 18:17.910
So we can copy this.

18:20.770 --> 18:25.670
So we're going to use A1, which is the attack mode for combinator.

18:25.910 --> 18:29.450
These hashes are MD5, so we're going to say M0.

18:29.450 --> 18:33.310
M0 is the mode identifier for MD5.

18:33.570 --> 18:39.210
HashCat provides an example list of hashes, so this is going to be the list of MD5 hashes.

18:39.210 --> 18:44.990
And then the two example dictionaries, which are actually the same dictionary, so we're just going to specify it twice.

18:44.990 --> 18:47.630
You could do this with two different dictionaries.

18:47.730 --> 18:54.770
So if you had example.dict and then example1.dict that has some different word set in it, that will work.

18:54.770 --> 18:56.710
And you could even reverse submit.

18:58.350 --> 19:00.530
So let's go ahead and run this.

19:02.190 --> 19:04.990
Go ahead and run this with the right name.

19:12.620 --> 19:15.000
And yeah, that's a lot.

19:15.280 --> 19:22.280
So we had, if we go back to our status output here, we know all this.

19:22.280 --> 19:28.420
We had a file which was example.dict on the left side, and a file which was example.dict on the right side.

19:28.420 --> 19:38.960
So if you think about it this way, you have example.dict and then example.dict.

19:39.260 --> 19:41.880
So this is going to be the left side.

19:41.920 --> 19:44.440
This is going to be the right side.

19:44.840 --> 19:55.040
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:55.760 --> 19:59.300
So we can see here that we went quite a bit faster this time.

19:59.300 --> 20:05.240
So we went at 5.8 billion candidates per second.

20:05.240 --> 20:15.240
We recovered 2,906 of 6,494 digests, so just under 45 percent.

20:15.240 --> 20:19.860
And we have 3,588 hashes remaining.

20:22.080 --> 20:23.660
So the next one we'll do

20:29.720 --> 20:31.760
is a brute force.

20:31.760 --> 20:39.760
Now, this is going to be a very simple example of a mask attack, and we'll talk about mask attacks later.

20:40.620 --> 20:43.960
Brute forcing is when we take

20:47.880 --> 20:55.400
a string and then increment it by either a number or a letter to exhaust a full keyspace.

20:55.400 --> 21:07.560
So in this case, we're doing 1, 2, 3, let's see, 1, 2, 3, 4, 5, 6 spaces of all characters.

21:07.560 --> 21:14.500
So that's numbers, letters, lowercase and uppercase, and then specials.

21:15.000 --> 21:18.560
This is again going to be MD5.

21:18.640 --> 21:22.540
We're going to use the same example hash set that we used before.

21:23.040 --> 21:31.640
A3 is to specify a mask attack or a brute force attack, and then get this right the first time.

21:37.040 --> 21:38.720
And then we let it run.

21:39.240 --> 21:48.220
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:48.920 --> 22:02.220
And 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.

22:03.840 --> 22:04.600
Okay.

22:06.300 --> 22:12.100
So what Hashcat was doing in that mode, so we had this mask specified.

22:13.040 --> 22:21.140
We said we want to try all possible combinations of all printable ASCII characters on a standard keyboard.

22:21.140 --> 22:23.160
So we have 95 of those.

22:23.200 --> 22:28.300
So for each one of these positions, it's going to try all 95 possibilities.

22:28.760 --> 22:37.040
So if we look at it this way, let's say it starts at 1, 2, 3, 4, 5, 6 A's.

22:38.400 --> 22:43.360
And then it tries 1, 2, 3, 4, 5, 6 with a B.

22:43.760 --> 22:47.720
And then it tries 1, 2, 3, 4, 5 with a C.

22:48.120 --> 22:55.880
And it continues to increment until C gets to Z, and then it shifts by 1.

22:57.000 --> 23:02.020
So then we have 1, 2, 3, 4, B, A.

23:03.340 --> 23:07.420
1, 2, 3, 4, B, B, and so on and so forth.

23:07.420 --> 23:17.100
But since we're going so fast, the incrementing of the characters goes ridiculously fast.

23:18.500 --> 23:27.240
So that is your basic rundown of the three very basic attack modes that HashCat does.

23:28.140 --> 23:39.320
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.

23:39.320 --> 23:45.000
And also some examples of how to use the commands for a given attack mode.

23:47.340 --> 23:52.380
So that's all we've got for now, and hope you join us for the next talk!

