1
1

00:00:00,450  -->  00:00:02,400
<v Instructor>Authentication attacks.</v>
2

2

00:00:02,400  -->  00:00:03,300
In this lesson,
3

3

00:00:03,300  -->  00:00:05,730
we are going to talk about authentication attacks
4

4

00:00:05,730  -->  00:00:07,680
and what you can do to prevent them.
5

5

00:00:07,680  -->  00:00:09,600
We're going to talk about things like spoofing,
6

6

00:00:09,600  -->  00:00:13,020
On-Path attacks, password spraying, credential stuffing
7

7

00:00:13,020  -->  00:00:16,440
and broken authentication, as well as several others.
8

8

00:00:16,440  -->  00:00:18,090
Now, when we talk about spoofing,
9

9

00:00:18,090  -->  00:00:19,860
this is a software based attack
10

10

00:00:19,860  -->  00:00:22,590
where the goal is to assume the identity of a user,
11

11

00:00:22,590  -->  00:00:26,130
a process, an address or other unique identifier.
12

12

00:00:26,130  -->  00:00:29,220
Spoofing has used a lot to try to bypass authentication
13

13

00:00:29,220  -->  00:00:32,040
and be able to present yourself as if you're somebody else.
14

14

00:00:32,040  -->  00:00:34,320
Now, one of the things attackers love to try is
15

15

00:00:34,320  -->  00:00:35,460
an On-path attacks.
16

16

00:00:35,460  -->  00:00:37,650
Now, an On-path attack is attack where the attacker
17

17

00:00:37,650  -->  00:00:39,900
is going to sit between two communicating hosts
18

18

00:00:39,900  -->  00:00:41,910
and transparently captures, monitors
19

19

00:00:41,910  -->  00:00:44,760
and relays the communications between those hosts.
20

20

00:00:44,760  -->  00:00:46,470
Now, we've talked about an On-Path attack before
21

21

00:00:46,470  -->  00:00:48,330
but essentially if you're on a wireless network,
22

22

00:00:48,330  -->  00:00:50,940
somebody could be sniffing the air, capturing those packets
23

23

00:00:50,940  -->  00:00:52,440
and then being a man in the middle,
24

24

00:00:52,440  -->  00:00:54,360
they can capture what's being said.
25

25

00:00:54,360  -->  00:00:55,440
Now, if they put themselves directly
26

26

00:00:55,440  -->  00:00:56,640
in the middle of the communication,
27

27

00:00:56,640  -->  00:00:58,080
you might be connecting to them
28

28

00:00:58,080  -->  00:00:59,550
and they would be connecting to the server
29

29

00:00:59,550  -->  00:01:01,320
and they're listening to everything you say.
30

30

00:01:01,320  -->  00:01:03,870
They can capture it moderate and relay it right on
31

31

00:01:03,870  -->  00:01:06,750
or they could even modify it if they wanted to.
32

32

00:01:06,750  -->  00:01:07,950
Now, a variation on this
33

33

00:01:07,950  -->  00:01:09,720
is what's known as a man-in-the-browser.
34

34

00:01:09,720  -->  00:01:11,670
This is an MitB.
35

35

00:01:11,670  -->  00:01:13,980
This is an attack that intercepts the API calls
36

36

00:01:13,980  -->  00:01:16,710
between the browser process and its DLLs.
37

37

00:01:16,710  -->  00:01:18,480
And so if you're attacking the network
38

38

00:01:18,480  -->  00:01:20,610
or between two clients who are a client and a server,
39

39

00:01:20,610  -->  00:01:21,780
you're on-path attack.
40

40

00:01:21,780  -->  00:01:23,280
If you're using the browser to do it,
41

41

00:01:23,280  -->  00:01:25,200
you're a man-in-the-browser.
42

42

00:01:25,200  -->  00:01:27,450
Now, one of the things that people love to try to do
43

43

00:01:27,450  -->  00:01:30,150
is break passwords because if they can get your password
44

44

00:01:30,150  -->  00:01:32,130
they can own your system, right?
45

45

00:01:32,130  -->  00:01:34,320
Well, let's talk about the way passwords work for a moment.
46

46

00:01:34,320  -->  00:01:36,720
This will be a quick review from security plus.
47

47

00:01:36,720  -->  00:01:39,660
Now, when you take a password and you go to store it,
48

48

00:01:39,660  -->  00:01:42,480
do you store it in the database as the word password?
49

49

00:01:42,480  -->  00:01:44,310
No, you actually hash it first.
50

50

00:01:44,310  -->  00:01:45,780
So it's going to be an MD5 hash
51

51

00:01:45,780  -->  00:01:48,570
or a SHA-1 hash or a SHA-256 hash
52

52

00:01:48,570  -->  00:01:50,850
and it's going to be able to be stored in that database
53

53

00:01:50,850  -->  00:01:54,900
as that hash so, nobody knows what that actual password is,
54

54

00:01:54,900  -->  00:01:57,240
not even the system administrator in theory.
55

55

00:01:57,240  -->  00:02:00,210
Now, this means that that password cannot be recoverable
56

56

00:02:00,210  -->  00:02:03,210
'cause you can't go from the hash back to the original.
57

57

00:02:03,210  -->  00:02:05,010
So when the user chooses that password,
58

58

00:02:05,010  -->  00:02:06,180
we're going to make sure we hash it
59

59

00:02:06,180  -->  00:02:07,530
using that cryptographic function
60

60

00:02:07,530  -->  00:02:09,480
anytime we store it to our database.
61

61

00:02:09,480  -->  00:02:10,740
This will help protect our users
62

62

00:02:10,740  -->  00:02:12,720
inside our web applications.
63

63

00:02:12,720  -->  00:02:13,920
Now, even though we do that,
64

64

00:02:13,920  -->  00:02:16,530
a lot of people are still going to try to guess your password.
65

65

00:02:16,530  -->  00:02:18,660
Now there's a lot of different ways that they try to do this
66

66

00:02:18,660  -->  00:02:19,650
and one of the most common
67

67

00:02:19,650  -->  00:02:22,110
is what's known as an online password attack.
68

68

00:02:22,110  -->  00:02:24,240
This involves somebody simply trying to guess
69

69

00:02:24,240  -->  00:02:25,230
what your password is
70

70

00:02:25,230  -->  00:02:27,330
and entering it directly to the service.
71

71

00:02:27,330  -->  00:02:28,320
Think about this way,
72

72

00:02:28,320  -->  00:02:30,930
I want to log into Facebook as if I was you.
73

73

00:02:30,930  -->  00:02:33,300
I know your username because it's tied to your email.
74

74

00:02:33,300  -->  00:02:35,070
So, I type in your email address
75

75

00:02:35,070  -->  00:02:38,040
and I start typing in passwords and try hitting login.
76

76

00:02:38,040  -->  00:02:40,830
Each time I do that, I'm doing an online password attack.
77

77

00:02:40,830  -->  00:02:42,960
I'm guessing passwords over and over and over again
78

78

00:02:42,960  -->  00:02:44,610
until I get in.
79

79

00:02:44,610  -->  00:02:46,770
Now, this is the idea of how you can do
80

80

00:02:46,770  -->  00:02:48,270
an online password attack.
81

81

00:02:48,270  -->  00:02:50,370
Now how can you, as an analyst identify
82

82

00:02:50,370  -->  00:02:51,780
that that's what's going on?
83

83

00:02:51,780  -->  00:02:53,520
Well, you can look at the logs.
84

84

00:02:53,520  -->  00:02:54,840
If you look at your audit logs,
85

85

00:02:54,840  -->  00:02:56,820
you should see something that looks like this.
86

86

00:02:56,820  -->  00:02:59,460
Here, somebody was trying to log in as Jason.
87

87

00:02:59,460  -->  00:03:02,610
They tried at 1912 and they tried using the word password.
88

88

00:03:02,610  -->  00:03:05,640
Then they tried 1913 using pass1234.
89

89

00:03:05,640  -->  00:03:10,140
Then they tried 1914, puppy123; 1915 cupcake;
90

90

00:03:10,140  -->  00:03:14,280
1916 admin; 1917 admin123.
91

91

00:03:14,280  -->  00:03:15,690
And so this is an example
92

92

00:03:15,690  -->  00:03:16,980
of when you see somebody trying to do
93

93

00:03:16,980  -->  00:03:18,540
an online password attack.
94

94

00:03:18,540  -->  00:03:19,650
They're basically going in
95

95

00:03:19,650  -->  00:03:21,960
and logging in as if they were you just like you would
96

96

00:03:21,960  -->  00:03:23,340
except they're using the wrong password
97

97

00:03:23,340  -->  00:03:24,750
'cause they don't know yours yet.
98

98

00:03:24,750  -->  00:03:26,760
This can be useful if you know the person
99

99

00:03:26,760  -->  00:03:28,230
and if you're an attacker who has some knowledge
100

100

00:03:28,230  -->  00:03:29,130
about that person
101

101

00:03:29,130  -->  00:03:31,230
and can try to guess something that they might be thinking.
102

102

00:03:31,230  -->  00:03:34,080
But otherwise, it's a pretty inefficient way of doing it.
103

103

00:03:34,080  -->  00:03:36,330
Now to prevent this type of an attack from happening,
104

104

00:03:36,330  -->  00:03:38,160
there's really a couple things you can do.
105

105

00:03:38,160  -->  00:03:40,830
You can restrict the number or the rate of login attempts
106

106

00:03:40,830  -->  00:03:42,900
to prevent these online password attacks.
107

107

00:03:42,900  -->  00:03:45,810
So, you can lock the account after three incorrect attempts
108

108

00:03:45,810  -->  00:03:48,510
where they have to reset their password or contact security.
109

109

00:03:48,510  -->  00:03:49,830
That would be one way to do it
110

110

00:03:49,830  -->  00:03:52,650
or you could say you can only log in three times
111

111

00:03:52,650  -->  00:03:53,483
and if you get it wrong,
112

112

00:03:53,483  -->  00:03:55,800
you have to wait 20 minutes and then it would reset again.
113

113

00:03:55,800  -->  00:03:57,390
That's limiting the rate of it.
114

114

00:03:57,390  -->  00:03:59,700
And so these are different ways that you can do this.
115

115

00:03:59,700  -->  00:04:00,810
Now, another way that people will try
116

116

00:04:00,810  -->  00:04:03,600
to break into your password is by doing password spraying.
117

117

00:04:03,600  -->  00:04:05,280
This is a brute force type of attack
118

118

00:04:05,280  -->  00:04:07,290
in which multiple user accounts are tested
119

119

00:04:07,290  -->  00:04:09,630
with a dictionary of common passwords.
120

120

00:04:09,630  -->  00:04:11,370
So, here's an example of this,
121

121

00:04:11,370  -->  00:04:13,740
going from 1912 to 1917 again.
122

122

00:04:13,740  -->  00:04:16,170
Notice the first two attempts were against Jason.
123

123

00:04:16,170  -->  00:04:18,600
They tried password and pass123.
124

124

00:04:18,600  -->  00:04:21,240
The second two attempts were against Tim using again,
125

125

00:04:21,240  -->  00:04:23,310
password and password123.
126

126

00:04:23,310  -->  00:04:25,290
The third attempt was against Tamera,
127

127

00:04:25,290  -->  00:04:27,240
password and password123.
128

128

00:04:27,240  -->  00:04:28,650
Notice the difference here.
129

129

00:04:28,650  -->  00:04:30,900
We have groupings of the same passwords
130

130

00:04:30,900  -->  00:04:32,850
that are common words from a dictionary
131

131

00:04:32,850  -->  00:04:35,460
being tried over and over again against different accounts.
132

132

00:04:35,460  -->  00:04:36,870
This makes it password spraying
133

133

00:04:36,870  -->  00:04:39,330
instead of an online password attack.
134

134

00:04:39,330  -->  00:04:40,800
Now the last one we're going to talk about here
135

135

00:04:40,800  -->  00:04:42,300
is credential stuffing.
136

136

00:04:42,300  -->  00:04:44,040
Now, credential stuffing is another type
137

137

00:04:44,040  -->  00:04:45,480
of brute force attack.
138

138

00:04:45,480  -->  00:04:47,010
In this one, they're going to try to take
139

139

00:04:47,010  -->  00:04:49,170
stolen user account names and passwords
140

140

00:04:49,170  -->  00:04:51,420
and test them against multiple websites.
141

141

00:04:51,420  -->  00:04:53,280
So, let's say there was a new story
142

142

00:04:53,280  -->  00:04:54,780
and there was a new data breach that happened
143

143

00:04:54,780  -->  00:04:56,190
and Facebook got hacked,
144

144

00:04:56,190  -->  00:04:58,950
and now, all of Facebook's username and passwords are known.
145

145

00:04:58,950  -->  00:05:00,840
So everybody knows what the usernames are
146

146

00:05:00,840  -->  00:05:02,910
which are emails and the passwords.
147

147

00:05:02,910  -->  00:05:04,740
Now, Facebook is going to make everybody go in
148

148

00:05:04,740  -->  00:05:06,240
and change their passwords, right?
149

149

00:05:06,240  -->  00:05:07,890
So you're not going to be able to get back into Facebook
150

150

00:05:07,890  -->  00:05:10,110
but they could take that username and password
151

151

00:05:10,110  -->  00:05:14,580
and try it on Gmail or Yahoo or MSN or some other website.
152

152

00:05:14,580  -->  00:05:16,740
And by going across to different websites,
153

153

00:05:16,740  -->  00:05:18,420
you can try doing this credential stuffing
154

154

00:05:18,420  -->  00:05:20,340
because you know it was a valid username and password
155

155

00:05:20,340  -->  00:05:21,420
on one system.
156

156

00:05:21,420  -->  00:05:22,560
It may be on others
157

157

00:05:22,560  -->  00:05:25,350
because people tend to reuse your user and passwords.
158

158

00:05:25,350  -->  00:05:27,270
So, how do you prevent credential stuffing?
159

159

00:05:27,270  -->  00:05:29,400
Well, credential stuffing can be prevented
160

160

00:05:29,400  -->  00:05:32,910
by not reusing passwords across these different websites.
161

161

00:05:32,910  -->  00:05:34,350
Now, the next thing we want to talk about
162

162

00:05:34,350  -->  00:05:36,150
is broken authentication.
163

163

00:05:36,150  -->  00:05:38,610
Broken authentication is a software vulnerability
164

164

00:05:38,610  -->  00:05:40,200
where the authentication mechanisms
165

165

00:05:40,200  -->  00:05:42,330
allow the attacker to gain entry.
166

166

00:05:42,330  -->  00:05:45,450
Essentially, the coders did a really bad job.
167

167

00:05:45,450  -->  00:05:47,730
Now, when this happens, you can have bad things happen
168

168

00:05:47,730  -->  00:05:49,620
like displaying clearex credentials
169

169

00:05:49,620  -->  00:05:50,970
using weak session tokens
170

170

00:05:50,970  -->  00:05:53,490
or permitting brute force login requests.
171

171

00:05:53,490  -->  00:05:55,530
Now, what causes these type of things?
172

172

00:05:55,530  -->  00:05:57,960
Well, weak password credentials for one.
173

173

00:05:57,960  -->  00:05:59,040
Let's say, you built a system
174

174

00:05:59,040  -->  00:06:01,530
and you said all passwords will be four digits long.
175

175

00:06:01,530  -->  00:06:02,550
That's a pretty weak system.
176

176

00:06:02,550  -->  00:06:04,020
There's only a thousand variations
177

177

00:06:04,020  -->  00:06:06,300
so people could brute force their way in.
178

178

00:06:06,300  -->  00:06:07,290
Another thing that would happen is
179

179

00:06:07,290  -->  00:06:09,510
if you had weak password reset methods.
180

180

00:06:09,510  -->  00:06:11,880
So you're going to use something like knowledge factors
181

181

00:06:11,880  -->  00:06:14,430
that are tied to things that people could easily look up.
182

182

00:06:14,430  -->  00:06:15,630
What is your birthday?
183

183

00:06:15,630  -->  00:06:16,950
Where were you born?
184

184

00:06:16,950  -->  00:06:18,750
What state are you registered to vote in?
185

185

00:06:18,750  -->  00:06:19,800
These are all weak things
186

186

00:06:19,800  -->  00:06:21,300
because most of this information is stuff
187

187

00:06:21,300  -->  00:06:23,010
you can find online about people
188

188

00:06:23,010  -->  00:06:25,410
so we wouldn't want to use those type of things.
189

189

00:06:25,410  -->  00:06:27,240
Next, you have credential exposure.
190

190

00:06:27,240  -->  00:06:29,130
Now, credential exposures when the app
191

191

00:06:29,130  -->  00:06:30,960
actually exposes the credentials
192

192

00:06:30,960  -->  00:06:32,280
or the authentication tokens
193

193

00:06:32,280  -->  00:06:33,510
to somebody who's in the middle,
194

194

00:06:33,510  -->  00:06:34,980
so if we have a man in the middle.
195

195

00:06:34,980  -->  00:06:36,240
Now, this is really bad
196

196

00:06:36,240  -->  00:06:38,790
because a lot of applications will hard code credentials
197

197

00:06:38,790  -->  00:06:42,060
into the application, or they're not using encryption
198

198

00:06:42,060  -->  00:06:44,280
so they're sending things across the network in plain text
199

199

00:06:44,280  -->  00:06:45,750
or they're using weak encryption,
200

200

00:06:45,750  -->  00:06:47,190
and so because they're using weak encryption,
201

201

00:06:47,190  -->  00:06:48,120
it can be cracked.
202

202

00:06:48,120  -->  00:06:48,953
These are all things
203

203

00:06:48,953  -->  00:06:50,700
that can lead to this credential exposure.
204

204

00:06:50,700  -->  00:06:53,010
And then finally, we have session hijacking.
205

205

00:06:53,010  -->  00:06:54,690
This is when the application is vulnerable
206

206

00:06:54,690  -->  00:06:55,890
to session hijacking
207

207

00:06:55,890  -->  00:06:57,750
because maybe you're using session keys
208

208

00:06:57,750  -->  00:06:58,950
that just aren't really strong
209

209

00:06:58,950  -->  00:07:00,390
and they're really easy to guess.
210

210

00:07:00,390  -->  00:07:02,790
And so that's an easy way for people to guess that session,
211

211

00:07:02,790  -->  00:07:04,290
jump into it, hijack it
212

212

00:07:04,290  -->  00:07:06,240
and then get the information they want.
