1 00:00:01,360 --> 00: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. 2 00:00:07,740 --> 00: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. 3 00:00:14,660 --> 00:00:21,740 The goal here is to start building a foundation that other talks throughout the village and DEF CON will expand on. 4 00:00:22,160 --> 00:00:27,920 So ideally you're going to have a GTX model NVIDIA card and be running Linux. 5 00:00:27,980 --> 00: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. 6 00:00:41,460 --> 00:00:44,360 So Hashcat supports two modes of operation. 7 00:00:44,360 --> 00: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. 8 00:00:53,820 --> 00:01:00,960 That can be Intel, that can be AMD, that can be NVIDIA, and that can be AMD video cards. 9 00:01:02,720 --> 00: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. 10 00:01:13,300 --> 00:01:18,500 Since we have an NVIDIA card on this box, we're going to go with the CUDA driver. 11 00:01:18,680 --> 00:01:20,980 Now we don't want to use the repo drivers. 12 00:01:21,180 --> 00: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. 13 00:01:43,840 --> 00:01:45,700 And we don't want that to happen. 14 00:01:45,700 --> 00: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. 15 00:01:54,220 --> 00: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. 16 00:02:07,120 --> 00: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. 17 00:02:19,880 --> 00: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. 18 00:02:34,920 --> 00:02:37,540 So we're going to go with the local run file. 19 00:02:38,100 --> 00:02:46,690 So we're going to copy this wget line here, paste that in, 20 00:02:52,860 --> 00:02:58,620 and then we're going to go ahead and grab our Hashcat binaries, 21 00:03:06,030 --> 00:03:13,790 and we also want the PGP signature so that we can verify that it's legit. 22 00:03:20,040 --> 00:03:23,300 And then we're going to want to grab the Hashcat key. 23 00:03:23,300 --> 00: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. 24 00:03:44,350 --> 00:03:55,230 Okay, now we've got our key, and then let's verify that our download is actually signed and correct. 25 00:03:57,860 --> 00:04:01,900 Okay, so there we go, we've got a good signature. 26 00:04:03,900 --> 00:04:05,780 So we are good there. 27 00:04:06,360 --> 00: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. 28 00:04:22,100 --> 00:04:23,880 So let's grab that guy. 29 00:04:32,030 --> 00:04:34,310 Let's grab it incredibly slowly. 30 00:04:42,610 --> 00: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. 31 00:05:00,190 --> 00: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. 32 00:05:12,390 --> 00: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. 33 00:05:22,790 --> 00: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. 34 00:05:31,130 --> 00:05:39,750 So let's just say this guy right here, and it's the latest release that it seems that Ubuntu has. 35 00:05:39,970 --> 00:05:49,170 And then we are going to apt-get build-dep NVIDIA driver 440. 36 00:05:49,170 --> 00:05:54,310 So we want to get all the dependencies that NVIDIA driver 440 requires. 37 00:05:56,330 --> 00: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. 38 00:06:16,410 --> 00:06:19,350 Let's make sure we get the editor in there as well. 39 00:06:22,390 --> 00:06:28,270 So we're going to uncomment this, and we're going to uncomment this, and that's all we need. 40 00:06:31,560 --> 00:06:37,560 Do a quick update, 41 00:06:46,900 --> 00:06:48,520 and let's try that again. 42 00:06:50,480 --> 00: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. 43 00:07:00,060 --> 00:07:01,720 Oh, we also need to grab one more thing. 44 00:07:01,720 --> 00:07:06,180 Because HashCat is packaged in the 7-zip format, we'll need to grab p7-zip. 45 00:07:23,940 --> 00:07:25,480 Any day now. 46 00:07:39,320 --> 00:07:40,200 Hello? 47 00:07:41,900 --> 00:07:42,780 AWS? 48 00:07:56,400 --> 00:07:58,480 So we'll grab p7-zip as well. 49 00:08:02,560 --> 00:08:04,420 Thankfully that didn't take as long. 50 00:08:06,240 --> 00:08:11,260 And we're going to bypass some of this. 51 00:08:11,420 --> 00:08:19,060 So if you run the CUDA SDK installer, it has a kind of menu-driven interface. 52 00:08:19,060 --> 00:08:20,480 We don't want that. 53 00:08:20,480 --> 00:08:25,620 So we're going to run it in silent mode, and we want to install the driver and the toolkit. 54 00:08:29,740 --> 00:08:31,680 And this is going to take a minute. 55 00:08:32,320 --> 00: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. 56 00:08:43,220 --> 00:08:45,580 So if we look at 57 00:08:51,120 --> 00:08:58,240 ldsoconf.conf.d... So it already wrote our CUDA library path, so that's good. 58 00:08:58,680 --> 00:09:04,200 But it did not write the path update for our profile. 59 00:09:05,240 --> 00:09:07,500 So we need to go ahead and add that in. 60 00:09:07,500 --> 00:09:18,440 So we'll do a sudo vi slash etc profile.d and we'll call this cuda.sh. 61 00:09:20,920 --> 00:09:29,880 And then in here, we're basically just adding the path to the CUDA binaries to our system path. 62 00:09:29,940 --> 00:09:35,240 And then this is going to load every time a new instance is spawned. 63 00:09:35,240 --> 00:09:40,300 So we'll go ahead and source except profile so we get the update. 64 00:09:45,230 --> 00:09:52,390 Okay, and then we also need to run ldconfig so that it updates the library path. 65 00:09:54,820 --> 00:10:03,480 Okay, and then let's check NVIDIA SMI and make sure that it sees our card. 66 00:10:03,500 --> 00:10:04,580 And it does. 67 00:10:04,580 --> 00: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. 68 00:10:14,520 --> 00:10:16,920 It's right here. 69 00:10:17,240 --> 00:10:19,860 And we can see we're on CUDA version 11. 70 00:10:20,120 --> 00:10:21,620 So that's good. 71 00:10:22,240 --> 00:10:26,460 So next, let's unpack Hashcat. 72 00:10:26,560 --> 00:10:31,340 So we're gonna 7-zip extract hashcat.7zip. 73 00:10:32,600 --> 00:10:38,740 And while we're at it, let's go ahead and bunzip to rocky.txt. 74 00:10:44,940 --> 00:10:46,440 All right. 75 00:10:48,120 --> 00:10:51,380 So let's make sure that Hashcat sees our video card now. 76 00:10:54,910 --> 00:10:56,070 And it does. 77 00:10:56,070 --> 00:11:00,390 And it sees that it can run in either CUDA or OpenCL mode. 78 00:11:00,530 --> 00: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. 79 00:11:09,290 --> 00:11:16,970 And then let's just do a quick benchmark to make sure that we actually get running. 80 00:11:17,870 --> 00:11:21,210 Okay, so we can see that it selected our device. 81 00:11:21,210 --> 00:11:27,010 It skipped the OpenCL part of that because it has the CUDA API. 82 00:11:27,270 --> 00:11:29,310 And there we go. 83 00:11:32,550 --> 00:11:38,890 So let's move into doing some simple attacks with Hashcat. 84 00:11:42,570 --> 00: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. 85 00:11:53,410 --> 00:11:56,250 So we've got our Hashcat examples here. 86 00:11:57,870 --> 00:12:04,450 You can copy and paste these off the site and follow along if you are set up to do so. 87 00:12:05,350 --> 00:12:07,370 Actually, let's get rid of this. 88 00:12:09,310 --> 00:12:12,230 And we'll call this nt.hash. 89 00:12:14,620 --> 00:12:19,460 We'll paste those guys in using whatever editor you desire. 90 00:12:21,360 --> 00:12:29,340 And then we used Hashmode1000 here because I know that 1000 is NTLM. 91 00:12:31,120 --> 00:12:38,120 But if you needed to find it, you could do a Hashcat help and then grep. 92 00:12:38,220 --> 00:12:45,100 We'll do a dash i so we do a case insensitive search and look for NTLM. 93 00:12:45,120 --> 00:12:49,280 And we can see right here NTLM is Mode1000. 94 00:12:49,480 --> 00:12:53,320 NetNTLM v1 and v2 are different hash types. 95 00:12:53,320 --> 00: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. 96 00:13:04,840 --> 00:13:11,020 So we want Hashcat.tacm1000 for mode. 97 00:13:11,240 --> 00:13:16,400 We want our nt.hash file and then we want to run this against RockView. 98 00:13:22,420 --> 00:13:24,860 So it's going to initialize the device there. 99 00:13:24,860 --> 00:13:29,580 It's going to load the dictionary and then it cracked all our hashes. 100 00:13:29,580 --> 00:13:34,120 It cracked all our hashes because these hashes were generated from RockView. 101 00:13:34,120 --> 00:13:37,680 So you would expect to to get all of those. 102 00:13:37,680 --> 00: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. 103 00:13:55,040 --> 00:13:58,440 So to kind of walk through this a little bit, there's a lot going on on the screen here. 104 00:13:58,440 --> 00:14:02,780 So we have our hashes up here and we have the associated plain text on the opposite side. 105 00:14:02,780 --> 00: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. 106 00:14:12,280 --> 00:14:14,320 And then we've got 10 of those. 107 00:14:14,700 --> 00:14:16,720 So we had a session name of HashCat. 108 00:14:16,780 --> 00: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. 109 00:14:26,400 --> 00:14:28,160 We're not going to cover that here. 110 00:14:28,340 --> 00: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. 111 00:14:36,480 --> 00:14:40,520 We were running against NTLMs. 112 00:14:41,280 --> 00:14:46,000 Our hash target was the hash file that we supplied called nt.hash. 113 00:14:46,360 --> 00:14:54,460 The guest base, meaning the candidate words that we were selecting from, came from a file called rocky.txt. 114 00:14:54,840 --> 00: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. 115 00:15:06,920 --> 00:15:08,120 Where are we at here? 116 00:15:17,420 --> 00:15:19,500 So we can see here we were going at about 117 00:15:24,080 --> 00:15:26,000 35.7 billion. 118 00:15:26,940 --> 00:15:28,520 It's pretty quick. 119 00:15:28,720 --> 00:15:33,540 But down here we were only going at about 7.7 million. 120 00:15:33,540 --> 00: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. 121 00:15:48,520 --> 00:15:51,760 So we recovered all 10 of our hashes, so we had 10 digests. 122 00:15:51,760 --> 00:15:54,380 A hash is also called a digest. 123 00:15:54,800 --> 00: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. 124 00:16:04,800 --> 00:16:10,820 It rejected none of them, and a rejection can come from a word that's too long. 125 00:16:10,820 --> 00:16:15,360 We had a restore point, which we didn't use because we're not doing a restore. 126 00:16:15,600 --> 00:16:17,900 And then we had the candidates down here. 127 00:16:17,900 --> 00:16:20,560 Now in a long run, this is going to show 128 00:16:23,600 --> 00:16:30,080 a sample of what words are currently being tried against the hashes. 129 00:16:30,080 --> 00: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. 130 00:16:44,020 --> 00: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. 131 00:16:52,140 --> 00:16:57,040 And then we have our hardware monitor, which was telling us some statistics about the card. 132 00:16:57,040 --> 00: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. 133 00:17:10,040 --> 00:17:13,720 So that's a very simple dictionary attack. 134 00:17:14,720 --> 00:17:15,960 So let's try 135 00:17:21,170 --> 00:17:25,470 doing a combinator attack. 136 00:17:25,470 --> 00: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 . 137 00:17:39,790 --> 00:17:41,930 And it's going to do that for each one. 138 00:17:41,930 --> 00:17:52,310 So in very large runs, this is not really the best attack to do because it can take years to complete. 139 00:17:52,310 --> 00: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. 140 00:18:06,010 --> 00:18:14,250 The example dictionaries here are actually reasonably small and it's a really good baseline for showing how the attack works. 141 00:18:14,250 --> 00:18:17,910 So we can copy this. 142 00:18:20,770 --> 00:18:25,670 So we're going to use A1, which is the attack mode for combinator. 143 00:18:25,910 --> 00:18:29,450 These hashes are MD5, so we're going to say M0. 144 00:18:29,450 --> 00:18:33,310 M0 is the mode identifier for MD5. 145 00:18:33,570 --> 00:18:39,210 HashCat provides an example list of hashes, so this is going to be the list of MD5 hashes. 146 00:18:39,210 --> 00:18:44,990 And then the two example dictionaries, which are actually the same dictionary, so we're just going to specify it twice. 147 00:18:44,990 --> 00:18:47,630 You could do this with two different dictionaries. 148 00:18:47,730 --> 00:18:54,770 So if you had example.dict and then example1.dict that has some different word set in it, that will work. 149 00:18:54,770 --> 00:18:56,710 And you could even reverse submit. 150 00:18:58,350 --> 00:19:00,530 So let's go ahead and run this. 151 00:19:02,190 --> 00:19:04,990 Go ahead and run this with the right name. 152 00:19:12,620 --> 00:19:15,000 And yeah, that's a lot. 153 00:19:15,280 --> 00:19:22,280 So we had, if we go back to our status output here, we know all this. 154 00:19:22,280 --> 00: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. 155 00:19:28,420 --> 00:19:38,960 So if you think about it this way, you have example.dict and then example.dict. 156 00:19:39,260 --> 00:19:41,880 So this is going to be the left side. 157 00:19:41,920 --> 00:19:44,440 This is going to be the right side. 158 00:19:44,840 --> 00: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. 159 00:19:55,760 --> 00:19:59,300 So we can see here that we went quite a bit faster this time. 160 00:19:59,300 --> 00:20:05,240 So we went at 5.8 billion candidates per second. 161 00:20:05,240 --> 00:20:15,240 We recovered 2,906 of 6,494 digests, so just under 45 percent. 162 00:20:15,240 --> 00:20:19,860 And we have 3,588 hashes remaining. 163 00:20:22,080 --> 00:20:23,660 So the next one we'll do 164 00:20:29,720 --> 00:20:31,760 is a brute force. 165 00:20:31,760 --> 00: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. 166 00:20:40,620 --> 00:20:43,960 Brute forcing is when we take 167 00:20:47,880 --> 00:20:55,400 a string and then increment it by either a number or a letter to exhaust a full keyspace. 168 00:20:55,400 --> 00: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. 169 00:21:07,560 --> 00:21:14,500 So that's numbers, letters, lowercase and uppercase, and then specials. 170 00:21:15,000 --> 00:21:18,560 This is again going to be MD5. 171 00:21:18,640 --> 00:21:22,540 We're going to use the same example hash set that we used before. 172 00:21:23,040 --> 00:21:31,640 A3 is to specify a mask attack or a brute force attack, and then get this right the first time. 173 00:21:37,040 --> 00:21:38,720 And then we let it run. 174 00:21:39,240 --> 00: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. 175 00:21:48,920 --> 00: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. 176 00:22:03,840 --> 00:22:04,600 Okay. 177 00:22:06,300 --> 00:22:12,100 So what Hashcat was doing in that mode, so we had this mask specified. 178 00:22:13,040 --> 00:22:21,140 We said we want to try all possible combinations of all printable ASCII characters on a standard keyboard. 179 00:22:21,140 --> 00:22:23,160 So we have 95 of those. 180 00:22:23,200 --> 00:22:28,300 So for each one of these positions, it's going to try all 95 possibilities. 181 00:22:28,760 --> 00: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. 182 00:22:38,400 --> 00:22:43,360 And then it tries 1, 2, 3, 4, 5, 6 with a B. 183 00:22:43,760 --> 00:22:47,720 And then it tries 1, 2, 3, 4, 5 with a C. 184 00:22:48,120 --> 00:22:55,880 And it continues to increment until C gets to Z, and then it shifts by 1. 185 00:22:57,000 --> 00:23:02,020 So then we have 1, 2, 3, 4, B, A. 186 00:23:03,340 --> 00:23:07,420 1, 2, 3, 4, B, B, and so on and so forth. 187 00:23:07,420 --> 00:23:17,100 But since we're going so fast, the incrementing of the characters goes ridiculously fast. 188 00:23:18,500 --> 00:23:27,240 So that is your basic rundown of the three very basic attack modes that HashCat does. 189 00:23:28,140 --> 00: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. 190 00:23:39,320 --> 00:23:45,000 And also some examples of how to use the commands for a given attack mode. 191 00:23:47,340 --> 00:23:52,380 So that's all we've got for now, and hope you join us for the next talk!