1
00:00:00,210 --> 00:00:02,520
Welcome to part four of this module

2
00:00:05,520 --> 00:00:09,810
now that we have covered the more popular word list creation tools.

3
00:00:09,810 --> 00:00:19,040
It's time to take a look at the infamous John the Ripper John the Ripper is a free password cracking

4
00:00:19,040 --> 00:00:23,480
software tool initially developed for Unix systems.

5
00:00:23,480 --> 00:00:33,020
It now runs on 15 different platforms 11 of which are architecture specific versions of Unix DOS when

6
00:00:33,140 --> 00:00:42,830
32 bios an open VM s it comes pre packed with Cally Linux and it is located under applications.

7
00:00:42,980 --> 00:00:54,660
Password attacks John John is one of the most popular password testing and breaking programs out there.

8
00:00:54,720 --> 00:00:59,140
It combines a number of password crackers into one package.

9
00:00:59,280 --> 00:01:05,000
Auto detects password hash types and includes a customizable cracker.

10
00:01:05,100 --> 00:01:14,220
It can be run against various encrypted password formats including several crypt password hashes most

11
00:01:14,220 --> 00:01:24,780
commonly found on various Unix versions such as based on DHS MDG 5 and blowfish Kerber Ross F S and

12
00:01:24,780 --> 00:01:36,710
windows and T 2000 XP 2003 and so forth additional modules have extended its ability to include empty

13
00:01:36,710 --> 00:01:45,590
four based password hashes and passwords stored in LDP my sequel and others John doesn't actually need

14
00:01:45,590 --> 00:01:52,910
a word list in order to function although providing one is usually a good idea for more complex hashes

15
00:01:57,610 --> 00:01:59,470
as a small aside.

16
00:01:59,470 --> 00:02:06,070
Notice that a single tack or dash is used for loading the help options with John.

17
00:02:06,070 --> 00:02:11,980
The first thing I want to point out because John doesn't really make it self evident is that unless

18
00:02:11,980 --> 00:02:17,420
you specify otherwise using the tack tack port equals name switch.

19
00:02:17,620 --> 00:02:23,120
John is going to save all of your cracked passwords to a default port file.

20
00:02:23,140 --> 00:02:28,440
This file is typically located in period slash John under the root directory.

21
00:02:32,330 --> 00:02:35,400
I'll demonstrate this once we have a few passwords.

22
00:02:35,420 --> 00:02:42,110
This is important to remember though in case you ever wish to either crack a Hash again perhaps to test

23
00:02:42,110 --> 00:02:47,870
out a new word list or if you just want to reference all of the hashes and passwords that you have cracked

24
00:02:47,870 --> 00:02:49,230
to date.

25
00:02:49,310 --> 00:02:55,460
There are several ways to use John and several approaches one can take to doing so.

26
00:02:55,730 --> 00:03:02,180
In this first example we're going to crack the shadow file that comes in Cally Linux.

27
00:03:02,180 --> 00:03:07,280
We already know the default password is tor but let's say that we forgot it.

28
00:03:07,490 --> 00:03:14,060
Or perhaps more likely we have pilfered the Etsy shadow file of another Linux system and wish to crack

29
00:03:14,060 --> 00:03:15,250
those passwords.

30
00:03:16,290 --> 00:03:18,590
This is about as easy as it gets.

31
00:03:18,600 --> 00:03:19,710
We just type.

32
00:03:19,710 --> 00:03:24,730
John get see Shadow and hit enter.

33
00:03:24,900 --> 00:03:27,540
No word list was needed in this example.

34
00:03:27,540 --> 00:03:33,870
In fact the use of a word list with John is purely optional although doing so will increase your chances

35
00:03:33,870 --> 00:03:38,290
of cracking the password if you run the same command again.

36
00:03:41,850 --> 00:03:47,580
Notice that it does not try to crack the password a second time nor does it display the already cracked

37
00:03:47,580 --> 00:03:48,860
password.

38
00:03:48,870 --> 00:03:54,960
This is because as I mentioned the information is stored in John's pot file.

39
00:03:54,960 --> 00:03:57,480
There are two ways to retrieve this information

40
00:04:00,690 --> 00:04:04,140
we could use the tac tac show option

41
00:04:07,090 --> 00:04:11,130
which shows us that the user name is Root and the password is Tor.

42
00:04:11,140 --> 00:04:17,620
It also displays the hash once again and more usernames and passwords would be listed if the file contained

43
00:04:17,620 --> 00:04:18,760
them.

44
00:04:18,760 --> 00:04:27,700
Alternatively now that we've got a user name and password we'll type Ellis and notice that John pot

45
00:04:27,730 --> 00:04:29,230
has been created.

46
00:04:29,440 --> 00:04:36,880
Again this is the default file and directory but you can use the aforementioned switch to create a unique

47
00:04:36,880 --> 00:04:38,890
port file.

48
00:04:38,890 --> 00:04:40,600
So if we cap the file

49
00:04:45,170 --> 00:04:54,860
we can see a rather long hash string and at the end of it after the colon we can see the password.

50
00:04:54,940 --> 00:05:00,160
Tor will refer back to this as we go.

51
00:05:00,220 --> 00:05:07,000
It isn't a horrible idea to create multiple port files for different projects since the program makes

52
00:05:07,000 --> 00:05:14,620
no effort to indicate wish which hash and cracked password came from which project and the list can

53
00:05:14,620 --> 00:05:17,000
grow quite long over time.

54
00:05:17,140 --> 00:05:25,390
One on quirk of John the Ripper is that I've noticed over the years is that sometimes with some formats

55
00:05:25,750 --> 00:05:32,410
John has this odd habit of cracking a password and then separating it into two parts as though they

56
00:05:32,410 --> 00:05:34,720
were two separate hashes.

57
00:05:34,720 --> 00:05:43,060
For example secret for eighty three might cat out as secret for the first line and 43 for the second.

58
00:05:43,300 --> 00:05:49,900
Even though it's really all one string using the Tac tac show command when you run John usually gives

59
00:05:49,900 --> 00:05:56,230
the full string so I don't know why the pot file displays it in this way.

60
00:05:56,230 --> 00:05:58,550
It can make things a bit confusing.

61
00:05:58,570 --> 00:06:05,770
So my point is that it's not a great idea to rely on just the pot file as a long term repository of

62
00:06:05,770 --> 00:06:08,660
your cracked passwords.

63
00:06:08,810 --> 00:06:09,490
All right.

64
00:06:09,490 --> 00:06:13,570
So in the basic example we cracked a shadow file.

65
00:06:13,570 --> 00:06:17,460
Now let's look at cracking a Windows 7 password file.

66
00:06:17,500 --> 00:06:20,520
This is only slightly more advanced.

67
00:06:20,810 --> 00:06:30,580
Here's the file we want to crack we can see in plain text that the user name is test let's pretend for

68
00:06:30,580 --> 00:06:37,030
a moment that we don't know what format this hash is a simple google search would probably tell us that

69
00:06:37,030 --> 00:06:44,800
Windows hashes are cracked using the elm format option but let's say that we don't know the exact source

70
00:06:44,860 --> 00:06:49,180
of a hash and therefore we can't easily just look it up.

71
00:06:49,180 --> 00:06:56,680
There's a handy little program called hash identifier that comes into play hash identifier comes prepackaged

72
00:06:56,680 --> 00:06:58,780
with Kelly 2.0.

73
00:06:58,810 --> 00:07:05,080
It's a simple little program and it's too simple to be an entire section unto itself.

74
00:07:05,080 --> 00:07:07,380
So this is the perfect moment to cover it.

75
00:07:08,440 --> 00:07:10,600
So first we're going to copy the hash.

76
00:07:10,750 --> 00:07:19,890
Please notice that everything between these two cones is the hash the 1 0 0 7 is not part of it.

77
00:07:19,930 --> 00:07:24,650
And I believe that this is the encrypted version of test.

78
00:07:24,790 --> 00:07:26,230
So we're going to minimize this

79
00:07:30,560 --> 00:07:32,360
and we'll call up hash identifier

80
00:07:47,530 --> 00:07:49,480
and now we will paste in our hash

81
00:07:53,620 --> 00:07:55,120
excellent hash.

82
00:07:55,170 --> 00:07:59,750
I.D. has determined that the hash is either empty five or elem.

83
00:07:59,890 --> 00:08:03,720
So if we didn't already know elem we'd probably try empty five.

84
00:08:03,720 --> 00:08:07,360
First we'd fail and then we'd try them.

85
00:08:07,660 --> 00:08:14,400
Since we know we'll skip the failure and go right in and crack the password to get out of hash identifier.

86
00:08:14,410 --> 00:08:28,180
Just press control C and now we'll type in John Tack Tack format equals l m Tak tak user equals test

87
00:08:28,210 --> 00:08:32,090
because that is the user name associated with this hash.

88
00:08:32,230 --> 00:08:38,260
If there was no user name associated with the hash you would just not include this and we'll give it

89
00:08:38,260 --> 00:08:45,340
the path route slash Windows 7 hash and we'll press enter.

90
00:08:45,430 --> 00:08:50,410
So we're using the first switch to specify the format of the hash to be cracked.

91
00:08:50,410 --> 00:08:56,410
The second is the user name associated with the hash and then we provide the path to the hash file which

92
00:08:56,410 --> 00:09:02,970
in my case is stored in the root directory and there we go right away.

93
00:09:03,000 --> 00:09:05,490
Password 1 2 3.

94
00:09:05,580 --> 00:09:12,120
But it's divided into two parts which is a little weird and if we cut the pot file

95
00:09:15,030 --> 00:09:16,980
we can see that the same thing has happened.

96
00:09:20,040 --> 00:09:30,040
That's a little weird but the password is in fact password or pass W R D I should say 1 2 3.

97
00:09:30,120 --> 00:09:35,610
So that's a little quirk of John like I was talking about before does that sometimes.

98
00:09:35,610 --> 00:09:42,150
But in any case it did give us the password so right away we see that we caches fall very easily to

99
00:09:42,150 --> 00:09:51,190
John we haven't needed to resort to a word list yet I created a text file with several simple empty

100
00:09:51,190 --> 00:09:54,570
five hashes for the next part of the demonstration.

101
00:09:59,300 --> 00:10:06,230
Again if we didn't already know these were empty fives we could just call up a hash identifier or some

102
00:10:06,230 --> 00:10:07,790
other similar tool.

103
00:10:07,790 --> 00:10:15,550
Paste the hash in and get a read out of the most probable formats so for this next attack let's go ahead

104
00:10:15,550 --> 00:10:17,860
and specify a word list.

105
00:10:17,860 --> 00:10:26,410
I created a very simple list using crunch just called Passwords dot text for more info about crunch

106
00:10:26,440 --> 00:10:34,500
please see the prior video now at this point you might be wondering if there is a list of all the formats

107
00:10:34,590 --> 00:10:47,390
that are available with John the Ripper and there is for this we just type John Tak tak sorry list people's

108
00:10:47,390 --> 00:10:55,130
formats and I have to say that for such a well regarded tool with such an illustrious history and the

109
00:10:55,130 --> 00:11:01,490
cracking community this read out is the sloppy est of all the cracking tools bundled with this operating

110
00:11:01,490 --> 00:11:08,870
system and you do actually need to find the correct format code in this mess because in some cases simply

111
00:11:08,870 --> 00:11:11,820
using empty 5 won't produce a result.

112
00:11:12,050 --> 00:11:18,530
In this case it expects us to type in raw MDG 5 so that's going to look like this.

113
00:11:18,530 --> 00:11:25,960
Shawn tack tack format equals raw dash empty five.

114
00:11:26,360 --> 00:11:34,640
We're gonna give it our path to the target and we're going to say word list equals root passwords and

115
00:11:34,640 --> 00:11:41,600
you could change everything after the equal sign for word list for example if you were using the rock

116
00:11:41,630 --> 00:11:43,370
you would list.

117
00:11:43,370 --> 00:11:46,130
You would simply give it that path and we press enter

118
00:11:49,730 --> 00:11:57,140
we can see that it cracked three of the six hashes we could specify a larger stronger word list and

119
00:11:57,140 --> 00:12:02,030
crack those remaining three but that could potentially take hours.

120
00:12:02,030 --> 00:12:07,940
Keep in mind that the larger the word list the longer this process will take.

121
00:12:07,940 --> 00:12:14,360
Also keep in mind that while John is performing the process of cracking hashes it is extremely resource

122
00:12:14,360 --> 00:12:15,170
intensive.

123
00:12:15,740 --> 00:12:22,250
If you decide to set John to work on cracking hashes for you overnight make absolutely sure that the

124
00:12:22,250 --> 00:12:29,090
cooling system for your computer is fully operational where you could seriously burn out your processor.

125
00:12:29,090 --> 00:12:36,150
I've seen old laptops heat up to dangerous temperatures when running John for prolonged periods since

126
00:12:36,150 --> 00:12:40,290
most people tend to leave John on to work overnight while they sleep.

127
00:12:40,290 --> 00:12:47,280
It's worth the safety reminder to make sure that nothing flammable is anywhere near your laptop or computer

128
00:12:47,280 --> 00:12:49,770
system just in case.

129
00:12:49,770 --> 00:12:56,580
So now let's take a look at how to crack into a password protected rar file.

130
00:12:56,580 --> 00:13:03,060
The process you're about to see is almost identical for a password protected zip file so crystal clear

131
00:13:03,060 --> 00:13:11,100
the screen the first thing we need to do is get the password hash for the raw file that we wish to break

132
00:13:11,100 --> 00:13:18,690
into the Ripper comes to the party prepared with RA to John which will give us a hash value for the

133
00:13:18,690 --> 00:13:20,130
File.

134
00:13:20,130 --> 00:13:26,770
We'll also be able to use zip to John in the same way for a zip file.

135
00:13:27,060 --> 00:13:35,580
So we take the rar file and we typed RAS to John secret dot Ra.

136
00:13:35,680 --> 00:13:42,730
I suppose I should point out that secret Ras is a file I created and a stored on my desktop.

137
00:13:42,760 --> 00:13:47,580
If you have the raw file in another directory you will need to provide the path

138
00:13:50,830 --> 00:13:52,720
and we're going to tie

139
00:13:57,680 --> 00:14:01,470
secret dot text.

140
00:14:01,500 --> 00:14:09,000
This will cause John the Ripper to create a text file which will contain the hash value of the password

141
00:14:09,000 --> 00:14:20,100
for the RAs and I'm afraid I am going to have to specify the directory so route desktop and we'll put

142
00:14:20,100 --> 00:14:25,490
this on Route desktop.

143
00:14:25,570 --> 00:14:26,950
There we go.

144
00:14:26,950 --> 00:14:27,630
Now

145
00:14:30,100 --> 00:14:32,460
secret Don't text has been created.

146
00:14:32,470 --> 00:14:33,600
And if we open it up

147
00:14:36,900 --> 00:14:42,620
we can see that we have the value for the hash.

148
00:14:42,630 --> 00:14:43,320
Great.

149
00:14:43,350 --> 00:14:50,190
So now you may be thinking that we're almost there and we are except for a bug that threw me for a loop

150
00:14:50,220 --> 00:14:56,800
for about four hours while trying to record this video and you may run into it as well.

151
00:14:56,850 --> 00:15:01,670
There's precious little help for it online which is why I'm including it in this video.

152
00:15:01,770 --> 00:15:09,090
If we did try to do this the way that John wants it to be done by saying John Tak tak format equals

153
00:15:09,090 --> 00:15:16,320
RA secret text we get this annoying and very uninformative error message.

154
00:15:16,330 --> 00:15:23,290
It doesn't matter how you try to adjust the syntax you won't get anywhere poring through forums.

155
00:15:23,290 --> 00:15:27,410
I've seen that many other people have had this same problem.

156
00:15:27,460 --> 00:15:36,030
The solution is just to remove the format switch now this quite naturally makes this process take much

157
00:15:36,030 --> 00:15:36,690
longer

158
00:15:39,730 --> 00:15:47,910
but at least it will work please note that again we could have used a custom word list here although

159
00:15:48,060 --> 00:15:51,050
it's really not necessary in this instance.

160
00:15:51,090 --> 00:15:57,750
John will crack this eventually and I'll press the spacebar while John works to give you an idea of

161
00:15:57,750 --> 00:16:01,630
how long this will take and of the progress being made.

162
00:16:01,680 --> 00:16:04,170
I'll make cuts to the video if need be.

163
00:16:04,320 --> 00:16:08,290
I'm not really sure exactly how long this will take.

164
00:16:08,310 --> 00:16:16,130
OK so why is this such a big issue for users of the Ripper as near as I can determine based on my research.

165
00:16:16,170 --> 00:16:19,400
Older versions of John worked just fine.

166
00:16:19,530 --> 00:16:26,610
Then somewhere along the way something went a little screwy with zip to John and RA to John in terms

167
00:16:26,610 --> 00:16:29,360
of how they write out the hash.

168
00:16:29,580 --> 00:16:35,610
I can't spot the error with my naked eye and I presume that the developers haven't been able to either

169
00:16:36,240 --> 00:16:42,450
the long and short of it is that John does not recognize the format of the hash.

170
00:16:42,450 --> 00:16:45,120
So when you specify a rar or zip.

171
00:16:45,270 --> 00:16:53,490
John throws up its hands spits out that error and just simply gives up by not specifying a format every

172
00:16:53,490 --> 00:16:55,740
format will be attempted.

173
00:16:55,740 --> 00:16:59,360
John literally throws the kitchen sink at the hash.

174
00:16:59,640 --> 00:17:05,670
So of course it takes about 30 times longer than again this is only a single hash that we're dealing

175
00:17:05,670 --> 00:17:06,570
with here.

176
00:17:06,720 --> 00:17:13,620
So that's good news but the bad news is that using every format like this means that a complex password

177
00:17:13,950 --> 00:17:16,970
is going to take much much longer to crack.

178
00:17:17,250 --> 00:17:21,950
As of the time of this recording I don't know what the fix is.

179
00:17:21,990 --> 00:17:26,790
You could downgrade to a much older version of John the Ripper though of course.

180
00:17:26,790 --> 00:17:28,690
I don't recommend doing that.

181
00:17:28,740 --> 00:17:33,530
Maybe if enough people complain the developers will finally fix the glitch.

182
00:17:33,660 --> 00:17:36,700
Or maybe I'm misunderstanding the nature of the error.

183
00:17:36,810 --> 00:17:42,930
In either case I recommend you try it with the format switch first and if it works for you.

184
00:17:42,930 --> 00:17:44,100
Great.

185
00:17:44,190 --> 00:17:48,900
If not you'll just have to bite the bullet until a better solution presents itself.

186
00:17:48,930 --> 00:17:53,850
While this is running I want to go over one more important thing about this process because there is

187
00:17:53,850 --> 00:18:01,470
a lot of misunderstanding particularly as it relates to encrypted zip and rar files.

188
00:18:01,470 --> 00:18:05,570
Password hashes are not extracted from the file itself.

189
00:18:05,580 --> 00:18:10,020
John the Ripper does not really do this to correct the misnomer.

190
00:18:10,020 --> 00:18:14,660
John the Ripper does not actually retrieve the hash from the file itself.

191
00:18:14,820 --> 00:18:18,660
It extracts certain information from the file.

192
00:18:18,660 --> 00:18:24,620
Also it is completely inaccurate to believe that the file is entirely encrypted.

193
00:18:24,630 --> 00:18:32,730
In the case in cases where encryption is being used instead critical unencrypted an encrypted file items

194
00:18:33,090 --> 00:18:38,640
such as the salt are retrieved to generate a non hash.

195
00:18:38,850 --> 00:18:45,900
These items are used by John the Ripper with various password guesses to test the decryption.

196
00:18:45,900 --> 00:18:53,610
It uses the zip or RAR password hash generation function to create a hash from the guesses that is in

197
00:18:53,610 --> 00:19:02,870
turn used to generate the crypt values the generated crypto values are then used to test against a small

198
00:19:03,200 --> 00:19:08,180
extracted and well-defined portion of the encrypted file.

199
00:19:08,240 --> 00:19:16,880
So while John the Ripper is not extracting a password password hash that can be sent to any old password

200
00:19:17,210 --> 00:19:24,680
hash checker rainbow table lookup thing it is doing the next best thing extracting critical cracking

201
00:19:24,680 --> 00:19:26,040
information.

202
00:19:26,180 --> 00:19:35,660
The steps to crack it are essentially one hash is generated from a password guests to a few extra steps

203
00:19:35,720 --> 00:19:44,960
are added to the check that decryption succeeds or fails and there are a lot of fails and three repeat

204
00:19:45,860 --> 00:19:53,450
what makes Rau cracking so difficult is a different salt for each RA file and more importantly the large

205
00:19:53,450 --> 00:20:01,280
and variable number of hash iterations that are needed before the decryption test can even be performed.

206
00:20:01,340 --> 00:20:06,740
The newer zip process is similar but the iterations are not variable.

207
00:20:06,740 --> 00:20:10,680
At least last time I checked making it somewhat easier.

208
00:20:10,880 --> 00:20:19,100
That is the nut of how it is done and the answer is you don't really get a password hash of a zip file

209
00:20:19,190 --> 00:20:24,350
or Rafael until just before the file is actually cracked.

210
00:20:24,380 --> 00:20:31,150
So this is just about done but I am going to make a cut to the video here already.

211
00:20:31,490 --> 00:20:37,100
So here we have the super secure password of 1 2 3 4.

212
00:20:37,130 --> 00:20:42,370
Now obviously I chose a weak password so that this process would not take too long.

213
00:20:42,380 --> 00:20:48,020
Remember that this password is now included in the john pot file with the others.

214
00:20:48,020 --> 00:20:53,810
Keep in mind also that you can use a word list for cracking this as you can with any other type of cracking

215
00:20:54,140 --> 00:20:55,530
that John performs.

216
00:20:55,550 --> 00:20:58,030
It's just not a requirement.

217
00:20:58,130 --> 00:21:05,280
All right then this covers all of the basic and most common uses of John the Ripper.

218
00:21:05,280 --> 00:21:10,720
Remember that John can be used to crack any sort of hash listed in the formats read out.

219
00:21:10,800 --> 00:21:15,120
So if you run up against a hash somewhere else by all means give it a try.

220
00:21:15,120 --> 00:21:19,030
This is a powerful tool with a lot of possibilities.

221
00:21:19,110 --> 00:21:23,470
It's been around forever and despite a few bugs that I really wish they would fix.

222
00:21:23,520 --> 00:21:25,530
It is pretty well maintained.

223
00:21:25,680 --> 00:21:31,980
If you find that John simply won't work right for you and Carly try it out on another operating system

224
00:21:32,040 --> 00:21:37,090
even windows as there are versions that work with just about everything.

225
00:21:37,110 --> 00:21:43,890
I hope this tutorial was helpful and I remind you to never use this or any other tool against any target

226
00:21:44,240 --> 00:21:48,350
that you do not personally own or have written permission to penetration test.

227
00:21:48,510 --> 00:21:50,550
Otherwise you might be breaking the law.

228
00:21:51,060 --> 00:21:51,480
Thank you.

