start	end	text
1360	4660	This is PrivacyNotIncluded, one of your Password Village leads, and I want to
4660	7740	welcome you to our first year running the Password Village.
7740	10840	We wanted to start off getting you up and running with Hashcat
10840	14660	on an NVIDIA GPU and then cover some basic attacks.
14660	18700	The goal here is to start building a foundation that other talks throughout
18700	22740	the village and DEF CON will expand on. So ideally
22740	25400	you're going to have a GTX model NVIDIA card
26140	30400	and be running Linux. The box we're on here is an AWS instance
30400	37000	running the stock Ubuntu 20.04 AMI, and it has a Tesla T4, which isn't
37000	40560	the greatest card for cracking, but it's going to work for our purposes.
41460	44800	So Hashcat supports two modes of operation. You have
44800	48000	OpenCL, which is a standard language, meaning that
48000	54580	it's going to run on any card or CPU that supports OpenCL. That can be
54580	58240	Intel, that can be AMD, that can be NVIDIA,
58240	60960	and that can be AMD video cards.
62720	66320	And then there's CUDA, which is specific to NVIDIA,
66320	71160	which will allow us to eek just a bit more performance out of the card
71160	75980	and get us some faster crack rates. Since we have an NVIDIA card on this box,
75980	79960	we're going to go with the CUDA driver. Now we don't want to use the repo
79960	82660	drivers. We don't want to use the repo drivers
82660	84620	because the
86460	92080	Ubuntu maintainers will include patches to those drivers that may fix a bug
92080	98220	for a desktop environment, for instance, but it breaks the
98220	102440	compatibility with the CUDA runtime and therefore
102440	105940	breaks Hashcat. And we don't want that to happen. So
105940	110980	we're going to use the driver that's supplied by NVIDIA,
110980	115560	and we're going to use the CUDA toolkit version. So we are on Linux,
115560	122960	we're on x86-64, so 64-bit processor, our 64-bit system, we're running Ubuntu,
122960	127120	we're running version 20.04, and then we have a couple of options here.
127120	129860	So we have a run file, which is a local install,
130220	133520	a local Debian install, which will create a
133520	136820	Debian archive on your, or sorry, a Debian repo
136820	139320	on your local box, and then you have the network install.
139880	145400	Because we want to maintain compatibility between the CUDA
145400	150540	version and the Hashcat release, we don't want to upgrade
151160	154920	CUDA as part of a system upgrade on accident and break it.
154920	157540	So we're going to go with the local run file.
158100	162720	So we're going to copy this wget line here,
165430	176680	paste that in, and then we're going to go ahead and grab
176680	189310	our Hashcat binaries, and we also want the
190170	193790	PGP signature so that we can verify that it's legit.
200040	203300	And then we're going to want to grab the Hashcat key.
203300	209020	So we see here we've got the fingerprint, scroll over here a bit, so we've got the
209020	212840	fingerprint here, and it says that it is on the PGP key
212840	217900	servers, so we can use GPG to go ahead and
217900	226530	import that key. Okay, now we've got our key,
227350	231750	and then let's verify that our download is actually
233510	240940	signed and correct. Okay, so there we go, we've got a good
240940	241900	signature.
243900	247820	So we are good there. So we're also going to grab
248380	252780	a word list, and we're going to grab that from Skull Security,
252780	257360	and we're going to be using Rocky, which is kind of an old list, but it's
257360	263880	also still really good. So let's grab that guy.
272030	284550	Let's grab it incredibly slowly. So the next part, we'll go ahead and
284550	287990	install the CUDA SDK, and it's going to
290330	293350	fail the first time we run it, because we're
293350	297130	on a brand new box that has no
297130	301230	dependencies installed at all. So there are
301230	305110	some things that the SDK is going to do, like build the
305110	308230	NVIDIA driver, and it's going to need to have
308230	312390	things like GCC and other libraries that it requires in order to do that.
312390	316950	So what we're actually going to do is kind of walk through the steps on
316950	320050	how we can make sure that we get all of those,
321170	324510	now that that's done. So we're going to do a search for
324510	329970	an Aptcache search for the NVIDIA driver, and we can see that there are a bunch of
329970	335470	them. So let's just say this guy right here,
335470	339750	and it's the latest release that it seems that Ubuntu has.
339970	342330	And then we are going to apt-get
343930	349930	build-dep NVIDIA driver 440. So we want to
349930	354310	get all the dependencies that NVIDIA driver 440 requires.
356330	363210	So we don't have any source listings for non-binary pulls in our
363210	377650	our app config, so let's go ahead and make that happen. Let's make sure we get
377650	384890	the editor in there as well. So we're going to uncomment this, and
384890	388270	we're going to uncomment this, and that's all we need.
391560	408520	Do a quick update, and let's try that again.
410480	414960	Okay, so we're going to go ahead and let all of that install, so this will
414960	417680	allow us to build our driver.
420060	421720	Oh, we also need to grab one more thing.
421720	424860	Because HashCat is packaged in the 7-zip format, we'll need to grab
424860	460200	p7-zip. Any day now. Hello?
461900	484420	AWS? So we'll grab p7-zip as well. Thankfully that didn't take as long.
486240	491260	And we're going to bypass some of this.
491420	497720	So if you run the CUDA SDK installer, it has a kind of menu-driven
497720	502620	interface. We don't want that. So we're going to run it in silent mode,
502620	510720	and we want to install the driver and the toolkit. And this is going to
510720	516160	take a minute. Okay, now there's one other step that if
516160	520680	we had used the menu-driven method, it would tell us that we need to
520680	525580	add some stuff to our path. So if we look at
531120	536620	ldsoconf.conf.d... So it already wrote our CUDA library
536620	541420	path, so that's good. But it did not write the
541420	547500	path update for our profile. So we need to go ahead and add that in.
547500	555120	So we'll do a sudo vi slash etc profile.d
555560	558440	and we'll call this cuda.sh.
560920	564260	And then in here, we're basically just adding
564260	571220	the path to the CUDA binaries to our system path. And then this is
571220	575900	going to load every time a new instance is spawned. So we'll go
575900	579340	ahead and source except profile so we get the
579340	587870	update. Okay, and then we also need to
587870	592390	run ldconfig so that it updates the library path.
594820	602220	Okay, and then let's check NVIDIA SMI and make sure that it
602220	606560	sees our card. And it does. So we've got our Tesla T4
607220	610960	and it is running on the driver version that was supplied with
610960	616920	the CUDA SDK, which is 450.51.05. It's right here.
617240	621620	And we can see we're on CUDA version 11. So that's good.
622240	628860	So next, let's unpack Hashcat. So we're gonna 7-zip extract
629620	635040	hashcat.7zip. And while we're at it, let's go ahead and
635040	638740	bunzip to rocky.txt.
644940	649720	All right. So let's make sure that Hashcat sees
649720	657270	our video card now. And it does. And it sees that it can
657270	662990	run in either CUDA or OpenCL mode. It's going to default to the CUDA
662990	666590	version here, so we don't need to worry about the
666590	670710	OpenCL info below us. And then let's just do a quick
670710	672510	benchmark to make sure that
674550	680070	we actually get running. Okay, so we can see that it selected our
680070	684710	device. It skipped the OpenCL part of that
684710	689310	because it has the CUDA API. And there we go.
692550	698890	So let's move into doing some simple attacks with Hashcat.
702570	705950	So we're going to go back to the Password Village site, which is at
705950	711630	passwordvillage.org, and we're going to grab some NT hashes.
713410	716250	So we've got our Hashcat examples here.
717870	721090	You can copy and paste these off the site and
721090	727370	follow along if you are set up to do so. Actually, let's get rid of this.
729310	736900	And we'll call this nt.hash. We'll paste those guys in using
736900	739460	whatever editor you desire.
741360	747300	And then we used Hashmode1000 here because I know that 1000
747300	749340	is NTLM.
751120	756000	But if you needed to find it, you could do a Hashcat help
756000	761360	and then grep. We'll do a dash i so we do a
761360	765760	case insensitive search and look for NTLM.
765760	770140	And we can see right here NTLM is Mode1000.
770140	774320	NetNTLM v1 and v2 are different hash types.
774320	778320	Typically you see those coming out of Responder, which
778320	781980	I believe EvilMog is going to do a talk on
781980	784840	later in the day that will quickly cover those.
784840	791020	So we want Hashcat.tacm1000 for mode.
791240	796400	We want our nt.hash file and then we want to run this against RockView.
802420	805760	So it's going to initialize the device there. It's going to load the dictionary
805760	811440	and then it cracked all our hashes. It cracked all our hashes because these
811440	816320	hashes were generated from RockView. So you would expect to
816320	820300	to get all of those. If you were pulling hashes from the wild,
820300	824800	you know, RockView may crack one of them, it may crack none of them, or it may
824800	827540	crack all of them depending on how good the password policy
827540	831640	of the the company or the site that was
831640	834120	compromised and the hashes were leaked from.
835040	838000	So to kind of walk through this a little bit, there's a lot going on on the
838000	839660	screen here. So we have our hashes up here
840040	843460	and we have the associated plain text on the opposite side. So you've got
843940	850960	this is a hash, we've got a separator, and then we have the plain text of this
850960	855380	hash. And then we've got 10 of those. So we had
855480	860000	a session name of HashCat. If we were doing
860720	864860	some session stuff where maybe we wanted to stop this and resume it later,
864860	869000	this name is important. We're not going to cover that here. The status would
869000	872620	normally be running, but since we only had a small sample and we knew
872620	876120	the plain text for all of those, it cracked them all pretty quick.
876480	883920	We were running against NTLMs. Our hash target was the hash file that
883920	889780	we supplied called nt.hash. The guest base, meaning the candidate
889780	894460	words that we were selecting from, came from a file called rocky.txt.
894840	898240	The speed of our device, which is actually pretty slow
898240	903520	compared to what we saw up here in the benchmark, because
904240	908120	it never got fully up to speed. Where are we at here?
917420	919500	So we can see here we were going at about
924080	928520	35.7 billion. It's pretty quick.
928720	933540	But down here we were only going at about 7.7 million.
933540	938620	So that's mainly because we didn't have
938620	942300	enough work to supply the GPU, but also because
942300	945680	we cracked all the hashes so quickly that it never got
946240	950900	a chance to get up to full speed. So we recovered all 10 of our hashes, so we had
950900	955320	10 digests. A hash is also called a digest. It
955320	959360	ran through the entire list of words, so we had 14.3 million
959360	964780	possible candidates, and we exhausted that entire space.
964800	967840	It rejected none of them, and a rejection can come from
969100	974000	a word that's too long. We had a restore point, which we didn't use because we're
974000	977620	not doing a restore. And then we had the candidates down
977620	980560	here. Now in a long run, this is going to show
983600	986640	a sample of what words are currently being
986640	991780	tried against the hashes. And here we have
991780	995420	some hex representation, and this is probably because we have
998260	1003120	a colon, which is a separator that HashCat uses
1003120	1006680	internally. So it's going to put that into a hex
1006680	1008600	representation so that it doesn't accidentally
1008600	1012140	cut your hash or your plain text in the wrong spot.
1012140	1016240	And then we have our hardware monitor, which was telling us some statistics
1016240	1020740	about the card. So it was running at 59 degrees celsius, it was at 75%
1020740	1023880	utilization, and then our core speed, the memory
1023880	1027960	speed, and the bus workload.
1030040	1033720	So that's a very simple dictionary attack.
1034720	1045470	So let's try doing a combinator attack.
1045470	1052470	Now a combinator attack is when you take two word lists and HashCat is
1052470	1055550	going to take one word from one word list and one
1055550	1059290	word from the other word list and smash them together and try that as a
1059290	1061930	candidate. And it's going to do that for each one.
1061930	1067770	So in very large runs, this is not really the best
1068830	1073650	attack to do because it can take years to complete. So if we were to use Rocky
1073650	1080190	with Rocky, for instance, we're doing 14.3 million to the 14.3 million, which
1080190	1082250	ends up being some ridiculous number that
1082250	1084730	we're probably never going to exhaust.
1086010	1089990	The example dictionaries here are actually reasonably small and
1089990	1094310	it's a really good baseline for showing how the attack works. So
1095710	1103850	we can copy this. So we're going to use A1, which is the
1103850	1108410	attack mode for combinator. These hashes are MD5, so we're going to
1108410	1113310	say M0. M0 is the mode identifier for MD5.
1113570	1117130	HashCat provides an example list of hashes, so this is
1117130	1121390	going to be the list of MD5 hashes. And then the two example dictionaries,
1121390	1124990	which are actually the same dictionary, so we're just going to specify it twice.
1124990	1128450	You could do this with two different dictionaries. So if you had
1128450	1132690	example.dict and then example1.dict that has some different word
1132690	1136710	set in it, that will work. And you could even reverse submit.
1138350	1140530	So let's go ahead and run this.
1142190	1144990	Go ahead and run this with the right name.
1152620	1157680	And yeah, that's a lot. So we had, if we go back to
1158460	1164520	our status output here, we know all this. We had a file which was example.dict
1164520	1167820	on the left side, and a file which was example.dict on the
1167820	1172000	right side. So if you think about it this way, you have
1172880	1173960	example.dict
1173960	1178960	and then example.dict.
1179260	1183000	So this is going to be the left side. This is going to be
1183000	1186820	the right side. And then again, Hashcat just
1186820	1192020	combined left and right, made a single word out of it,
1192020	1195040	hashed it, and then checked it against the list of hashes.
1195760	1199820	So we can see here that we went quite a bit faster this time. So we went
1199820	1205240	at 5.8 billion candidates per second.
1205240	1212720	We recovered 2,906 of 6,494 digests, so just under
1213240	1219860	45 percent. And we have 3,588 hashes remaining.
1222080	1223660	So the next one we'll do
1229720	1234960	is a brute force. Now, this is going to be a very simple
1235840	1239760	example of a mask attack, and we'll talk about mask attacks later.
1240620	1243960	Brute forcing is when we take
1247880	1252520	a string and then increment it by either a number or a letter
1253120	1256620	to exhaust a full keyspace. So in this case,
1256620	1263280	we're doing 1, 2, 3, let's see, 1, 2, 3, 4,
1263280	1269500	5, 6 spaces of all characters. So that's numbers,
1269500	1275980	letters, lowercase and uppercase, and then specials. This is again going
1275980	1280660	to be MD5. We're going to use the same example
1280660	1285800	hash set that we used before. A3 is to specify a mask attack or a
1285800	1291640	brute force attack, and then get this right the first time.
1297040	1300180	And then we let it run. So you'll see here that
1300180	1304380	we're only going to crack six-character passwords because we only specified
1304920	1308220	for Hashcat to crack six-character passwords.
1308920	1312440	And we can see we've got some lowercase, we had some numbers, now we've got an
1312440	1317360	uppercase here, there's an uppercase there, some stuff
1317360	1322220	starting with numbers, so lowercase.
1323840	1324600	Okay.
1326300	1332100	So what Hashcat was doing in that mode, so we had this mask specified.
1333040	1336660	We said we want to try all possible combinations of all
1337640	1341140	printable ASCII characters on a standard keyboard.
1341140	1345780	So we have 95 of those. So for each one of these positions, it's going to try
1346300	1352760	all 95 possibilities. So if we look at it this way, let's say it
1352760	1357040	starts at 1, 2, 3, 4, 5, 6 A's.
1358400	1366300	And then it tries 1, 2, 3, 4, 5, 6 with a B. And then it tries 1, 2, 3, 4,
1366300	1369980	5 with a C. And it continues to increment
1369980	1375880	until C gets to Z, and then it shifts by 1.
1377000	1382020	So then we have 1, 2, 3, 4, B, A.
1383340	1387640	1, 2, 3, 4, B, B, and so on and so forth. But
1387640	1391360	since we're going so fast, the
1392460	1397100	incrementing of the characters goes ridiculously fast.
1398500	1403980	So that is your basic rundown of the three
1403980	1407240	very basic attack modes that HashCat does.
1408140	1414680	You can go back and take a look at the standard attacks that are specified
1414680	1418100	on the Password Village website, if you need help understanding what was
1418100	1422620	going on. And also some examples of how to use the
1422620	1425000	commands for a given attack mode.
1427340	1430780	So that's all we've got for now, and hope you
1430780	1432380	join us for the next talk!
