start	end	text
0	4220	running the password village. We wanted to start off getting you up and running with
4220	10240	Hashcat on an NVIDIA GPU and then cover some basic attacks. The goal here is to start building
10440	16620	a foundation that other talks throughout the village and DEF CON will expand on. So ideally
16620	22820	you're going to have a GTX model NVIDIA card and be running Linux. The box we're on here
22820	30860	is an AWS instance running the stock Ubuntu 20.04 AMI, and it has a Tesla T4, which isn't
30860	36500	the greatest card for cracking, but it's going to work for our purposes. So Hashcat supports
36920	42220	two modes of operation. You have OpenCL, which is a standard language, meaning that it's
42220	50300	going to run on any card or CPU that supports OpenCL. That can be Intel, that can be AMD,
50300	58960	that can be NVIDIA, and that can be AMD video cards. And then there's CUDA, which is specific
58960	65420	to NVIDIA, which will allow us to eek just a bit more performance out of the card and
65420	70680	get us some faster crack rates. Since we have an NVIDIA card on this box, we're going to
70680	75740	go with the CUDA driver. Now we don't want to use the repo drivers. We don't want to
75740	84800	use the repo drivers because the Ubuntu maintainers will include patches to those drivers that
84800	92620	may fix a bug for a desktop environment, for instance, but it breaks the compatibility
93660	99560	with the CUDA runtime and therefore breaks Hashcat. And we don't want that to happen.
99560	106660	So we're going to use the driver that's supplied by NVIDIA, and we're going to use the CUDA
106660	115340	toolkit version. So we are on Linux, we're on x86-64, so 64-bit processor or 64-bit system.
115340	120640	We're running Ubuntu. We're running version 20.04. And then we have a couple of options
120640	125820	here. So we have a run file, which is a local install, a local Debian install, which will
125820	131620	create a Debian archive on your, or sorry, a Debian repo on your local box, and then
131620	139260	you have the network install. Because we want to maintain compatibility between the CUDA
139260	147080	version and the Hashcat release, we don't want to upgrade CUDA as part of a system upgrade
147080	152380	on accident and break it. So we're going to go with the local run file. So we're going
152380	170540	to copy this wget line here, paste that in. And then we're going to go ahead and grab
170540	186630	our Hashcat binaries. And we're also want the PGP signature so that we can verify that
186630	198700	it's legit. And then we're going to want to grab the Hashcat key. So we see here, we've
198700	204400	got the fingerprint. Scroll over here a bit. So we've got the fingerprint here, and it
204400	212280	says that it is on the PGP key servers. So we can use GPG to go ahead and import that
212280	227950	key. Okay, we've got our key. And then let's verify that our download is actually signed
227950	239540	and correct. Okay, so there we go, we've got a good signature. So we are good there.
240340	246480	So we're also going to grab a word list. And we're going to grab that from Skull Security.
246620	252700	And we're going to be using Rocky, which is kind of an old list, but it's also still really
252700	277750	good. So let's grab that guy. Let's grab it incredibly slowly. So the next part, we'll
277750	286870	go ahead and install the CUDA SDK. And it's going to fail the first time we run it, because
286870	296150	we're on a brand new box that has no dependencies installed at all. So there are some things
296150	302090	that the SDK is going to do, like build the NVIDIA driver, and it's going to need to have
302090	307230	things like GCC and other libraries that it requires in order to do that. So what we're
307230	312110	actually going to do is kind of walk through the steps on how we can make sure that we
312110	319330	get all of those. Now that that's done, so we're going to do a search for an Aptcache
319330	326130	search for the NVIDIA driver. And we can see that there are a bunch of them. So let's
326130	333870	just say this guy right here. And it's the latest release that seems that Ubuntu has.
333870	344370	And then we are going to apt-get build-dep NVIDIA driver 440. So we want to get all the
344370	356030	dependencies that NVIDIA driver 440 requires. So we don't have any source listings for non-binary
356030	371660	polls in our apt-config. So let's go ahead and make that happen. Make sure we get the
371660	379640	editor in there as well. So we're going to uncomment this, and we're going to uncomment
379640	406890	this and that's all we need. Do a quick update. And let's try that again. Okay. So we're going
406890	414570	to go ahead and let all that install. So this will allow us to build our driver. We also
414570	418330	need to grab one more thing because hashcat is packaged in the 7-zip format, we'll need
418330	477080	to grab p7-zip. Any day now. AWS? Thank you. So we'll grab p7-zip as well. Hopefully that
477080	489660	didn't take as long. And we're going to bypass some of this. So if you run the CUDA SDK installer,
489660	495780	it has a kind of menu-driven interface. We don't want that. So we're going to run it
495780	504500	in silent mode, and we want to install the driver and the toolkit. And this is going
504500	513080	to take a minute. Okay. Now there's one other step that if we had used the menu-driven method,
513080	528220	it would tell us that we need to add some stuff to our path. So if we look at ldsoconf.conf.d,
528740	536460	so it already wrote our CUDA library path, so that's good. But it did not write the path
536460	546180	update for our profile. So we need to go ahead and add that in. So we'll do a sudo vi slash etc
547960	559900	profile.d, and we'll call this cuda.sh. And then in here, we're basically just adding the path to
559900	568220	the CUDA binaries to our system path. And then this is going to load every time a new instance
568220	581240	is spawned. So we'll go ahead and source accept profile so we get the update. Okay. And then we
581240	593810	also need to run ldconfig so that it updates the library path. Okay. And then let's check
593810	601230	NVIDIA SMI and make sure that it sees our card. And it does. So we've got our Tesla T4,
601910	608850	and it is running on the driver version that was supplied with the CUDA SDK, which is 450.51.05.
608850	618290	It's right here. And we can see we're on CUDA version 11. So that's good. So next,
618290	625590	let's unpack Hashcat. So we're going to 7zip extract hashcat.7zip.
626850	633110	And while we're at it, let's go ahead and bunzip to rocky.txt.
639220	645800	All right. So let's make sure that Hashcat sees our video card now.
649160	654400	And it does. And it sees that it can run in either CUDA or OpenCL mode.
655120	661780	It's going to default to the CUDA version here. So we don't need to worry about the OpenCL info
661780	671220	below us. And then let's just do a quick benchmark to make sure that we actually get running.
672700	677560	Okay, so we can see that it selected our device. It skipped the OpenCL
678440	683320	part of that because it has the CUDA API. And there we go.
687340	693180	So let's move into doing some simple attacks with Hashcat.
696910	701430	So we're going to go back to the Password Village site, which is at passwordvillage.org.
702010	710570	And we are going to grab some NT hashes. So we've got our Hashcat examples here.
712210	718310	You can copy and paste these off the site and follow along if you are set up to do so.
719830	721950	Let's get rid of this.
724030	733870	We'll call this NT.hash. We'll paste those guys in using whatever editor you desire.
735950	744050	And then we used Hashmode 1000 here because I know that 1000 is NTLM.
745670	752290	But if you needed to find it, you could do a Hashcat help and then grep.
752690	759090	We'll do a dash I so we do a case insensitive search and look for NTLM.
759870	767670	And we can see right here NTLM is Mode 1000. Net NTLM V1 and V2 are different hash types.
767670	773830	Typically, you see those coming out of Responder, which I believe EvilMog is going to do a talk on
773830	781210	later in the day that will quickly cover those. So we want Hashcat
783090	790730	TACM 1000 for Mode. We want our NT.hash file. And then we want to run this against RockYou.
796800	800700	So it's going to initialize the device there. It's going to load the dictionary.
800800	806840	And then it cracked all our hashes. It cracked all our hashes because these hashes were generated
806840	814580	from RockYou. So you would expect to get all of those. If you were pulling hashes from the wild,
814580	820200	you know, RockYou may crack one of them, it may crack none of them, or it may crack all of them,
820200	826360	depending on how good the password policy of the company or the site that was compromised
826360	831420	and the hashes were leaked from. So to kind of walk through this a little bit, there's a lot
831420	836360	going on on the screen here. So we have our hashes up here and we have the associated plain text on
836360	844040	the opposite side. So you've got, this is a hash, we've got a separator, and then we have the plain
844040	852300	text of this hash. And then we've got 10 of those. So we had a session name of hashcat. If we were
854560	859480	doing some session stuff where maybe we wanted to stop this and resume it later,
859480	864240	this name is important. We're not going to cover that here. The status would normally be running,
864240	869280	but since we only had a small sample and we knew the plain text for all of those, it cracked them
869280	878720	all pretty quick. We were running against NTLMs. Our hash target was the hash file that we supplied
878720	886140	called nt.hash. The guest base, meaning the candidate words that we were selecting from,
886140	892580	came from a file called rockyou.txt. The speed of our device, which is actually pretty slow
892580	901420	compared to what we saw up here in the benchmark, because it never got fully up to speed. Where are
901420	920220	we at here? Right here. So we can see here we were going at about 35.7 billion.
921280	928160	It's pretty quick. But down here we were only going at about 7.7 million. So
931040	936500	that's mainly because we didn't have enough work to supply the GPU, but also because
936500	942460	we cracked all the hashes so quickly that it never got a chance to get up to full speed.
942840	948760	So we recovered all 10 of our hashes, so we had 10 digests. A hash is also called a digest.
949100	955540	It ran through the entire list of words, so we had 14.3 million possible candidates,
956180	962160	and we exhausted that entire space. It rejected none of them, and a rejection can come from
963460	969160	a word that's too long. We had a restore point, which we didn't use because we're not doing a
969160	974690	restore. And then we had the candidates down here. Now in a long run, this is going to show
977930	986130	a sample of what words are currently being tried against the hashes. And here we have
986130	996070	some hex representation, and this is probably because we have a colon, which is a separator
996070	1002230	that HashCat uses internally. So it's going to put that into a hex representation so that it
1002230	1007010	doesn't accidentally cut your hash or your plain text in the wrong spot. And then we have our
1007010	1012570	hardware monitor, which was telling us some statistics about the card. So it was running at
1012570	1019130	59 degrees Celsius, it was at 75% utilization, and then our core speed, the memory speed,
1019130	1030330	and the bus workload. So that's a very simple dictionary attack. So let's try
1037020	1041920	let's try doing a combinator attack. Now a combinator attack is when
1043520	1050160	you take two word lists, and HashCat is going to take one word from one word list and one word
1050160	1054680	from the other word list and smash them together and try that as a candidate. And it's going to
1054680	1065080	do that for each one. So in very large runs, this is not really the best attack to do because it can
1065080	1069800	take years to complete. So if we were to use Rocky with Rocky, for instance, we're doing
1070740	1077360	14.3 million to the 14.3 million, which ends up being some ridiculous number that we're probably
1077360	1085040	never going to exhaust. The example dictionaries here are actually reasonably small and it's a
1085040	1092320	really good baseline for showing how the attack works. So we can copy this.
1095160	1102260	So we're going to use A1, which is the attack mode for combinator. These hashes are MD5,
1102260	1110020	so we're going to say M0. M0 is the mode identifier for MD5. HashCat provides an example list of
1110020	1115760	hashes. So this is going to be the list of MD5 hashes and then the two example dictionaries,
1115760	1119300	which are actually the same dictionary, so we're just going to specify it twice.
1119300	1125580	You could do this with two different dictionaries. So if you had example.dict and then example1.dict
1125580	1130620	that has some different word set in it, that will work and you could even reverse some.
1132620	1134920	So let's go ahead and run this.
1136500	1139380	Go ahead and run this with the right name.
1146930	1154610	And yeah, that's a lot. So we had, if we go back to our status output here,
1155390	1161090	we know all this. We had a file which was example.dict on the left side and a file which was
1161090	1168310	example.dict on the right side. So if you think about it this way, you have example.dict
1170270	1178350	and then example.dict. So this is going to be the left side, this is going to be the right side,
1178910	1186330	and then again, Hashcat just combined left and right, made a single word out of it,
1186330	1189370	hashed it, and then checked it against the list of hashes.
1190070	1197070	So we can see here that we went quite a bit faster this time. So we went at 5.8 billion
1197810	1209050	candidates per second. We recovered 2,906 of 6,494 digests, so just under 45 percent,
1209630	1217970	and we have 3,588 hashes remaining. So the next one we'll do
1224030	1231830	is a brute force. Now, this is going to be a very simple example of a mask attack,
1231830	1238310	we'll talk about mask attacks later. Brute forcing is when we take
1242230	1249810	a string and then increment it by either a number or a letter to exhaust a full key space.
1249810	1258230	So in this case, we're doing 1, 2, 3, let's see, 1, 2, 3, 4, 5,
1259290	1267630	6 spaces of all characters, so that's numbers, letters, lowercase and uppercase, and then
1267630	1275730	specials. This is again going to be MD5. We're going to use the same example hash set that we
1275730	1284730	used before. A3 is to specify a mask attack or a brute force attack, and then get this right
1284730	1295950	the first time, and then we let it run. So you'll see here that we're only going to crack
1295950	1302630	six-character passwords because we only specified for HashCat to crack six-character passwords.
1303250	1309070	We can see we've got some lowercase, we had some numbers, now we've got an uppercase here,
1309070	1314370	there's an uppercase there, some stuff starting with numbers,
1314370	1318930	so lowercase. Okay.
1320630	1326530	So what HashCat was doing in that mode was, so we had this mask specified.
1327370	1334450	We said we want to try all possible combinations of all printable ASCII characters on a standard
1334450	1340110	keyboard. So we have 95 of those. So for each one of these positions, it's going to try
1340670	1351490	all 95 possibilities. So if we look at it this way, let's say it starts at 1, 2, 3, 4, 5, 6 As,
1352770	1362090	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,
1362090	1370270	and it continues to increment until C gets to Z, and then it shifts by 1.
1371070	1381950	So then we have 1, 2, 3, 4, B, A, 1, 2, 3, 4, B, B, and so on and so forth. But
1381950	1391270	since we're going so fast, the incrementing of the characters goes ridiculously fast.
1392830	1401590	So that is your basic rundown of the three very basic attack modes that HashCat does.
1402090	1409690	You can go back and take a look at the standard attacks that are specified on the Password
1409690	1415730	Village website if you need help understanding what was going on, and also some examples of
1415730	1419710	how to use the commands for a given attack mode.
1421670	1426710	So that's all we've got for now, and hope you join us for the next talk!
