WEBVTT - This file was automatically generated by VIMEO

0
00:00:06.400 --> 00:00:10.000
I have the web application which is

1
00:00:09.600 --> 00:00:12.100
 here and there are

2
00:00:12.100 --> 00:00:16.000
 many incoming requests many

3
00:00:15.500 --> 00:00:19.200
 actually concurrent incoming requests.

4
00:00:19.800 --> 00:00:22.400
To this web application and this

5
00:00:22.400 --> 00:00:26.500
 requests are about to transfer $10

6
00:00:26.500 --> 00:00:29.900
 from one account to another account. This

7
00:00:29.900 --> 00:00:32.300
 is exactly what I presented to you in

8
00:00:32.300 --> 00:00:36.100
 the demo. So this is my multifred attack

9
00:00:35.100 --> 00:00:36.700
 actually, right?

10
00:00:37.800 --> 00:00:40.600
And now I've got the money transfer requests

11
00:00:40.600 --> 00:00:44.800
 and let's assume that the for

12
00:00:43.800 --> 00:00:47.100
 example free requests have

13
00:00:46.100 --> 00:00:49.500
 already been accepted. Okay, so I've

14
00:00:49.500 --> 00:00:52.100
 got free money transfer requests that have

15
00:00:52.100 --> 00:00:55.200
 already been accepted and let me explain to you what it actually means.

16
00:00:55.200 --> 00:00:58.800
 So when you've got money transfer requests, then

17
00:00:58.800 --> 00:01:01.800
 the web application has to check whether you've

18
00:01:01.800 --> 00:01:04.500
 got enough money to you know, make this financial

19
00:01:04.500 --> 00:01:08.000
 transaction and if you've got enough money, then

20
00:01:07.400 --> 00:01:10.400
 the money transfer requests are gonna be

21
00:01:10.400 --> 00:01:13.300
 accepted. So these three guys and they are

22
00:01:13.300 --> 00:01:16.500
 waiting to be processed. Okay. So this is what I mean by

23
00:01:16.500 --> 00:01:19.500
 saying money transfer requests

24
00:01:19.500 --> 00:01:20.600
 that are accepted.

25
00:01:21.400 --> 00:01:24.200
Okay, but what more we're gonna

26
00:01:24.200 --> 00:01:29.200
 have in the story is we're gonna have the fourth request

27
00:01:29.200 --> 00:01:29.800
 as well.

28
00:01:31.200 --> 00:01:34.200
Let it be the four request here. And this

29
00:01:34.200 --> 00:01:37.900
 request here is where the financial

30
00:01:37.900 --> 00:01:41.100
 transaction is actually being made. So

31
00:01:40.100 --> 00:01:43.900
 what we've got is the requests there

32
00:01:43.900 --> 00:01:46.800
 are that are accepted and there are waiting to

33
00:01:46.800 --> 00:01:50.700
 be processed and we've got one request

34
00:01:50.700 --> 00:01:53.400
 here that has already been accepted but this is

35
00:01:53.400 --> 00:01:56.700
 actually where my financial transaction is

36
00:01:56.700 --> 00:02:00.000
 being made. So this is a kind of distinction between

37
00:01:59.800 --> 00:02:03.000
 this guy and this free guys

38
00:02:02.200 --> 00:02:03.500
 here, okay.

39
00:02:04.800 --> 00:02:05.700
So far so good.

40
00:02:06.400 --> 00:02:09.700
So what's gonna happen in in my attack?

41
00:02:09.700 --> 00:02:13.100
 Is that the balance

42
00:02:12.100 --> 00:02:16.400
 sooner or later will go to zero. My

43
00:02:15.400 --> 00:02:19.500
 attack is about sending

44
00:02:18.500 --> 00:02:21.200
 ten dollars and ten dollars

45
00:02:21.200 --> 00:02:24.800
 and so on many times right 10 dollars

46
00:02:24.800 --> 00:02:27.800
 ten dollars from one account to

47
00:02:27.800 --> 00:02:30.500
 another account. So sooner or later the balance

48
00:02:30.500 --> 00:02:33.900
 indeed will be zero. Now. Let's

49
00:02:33.900 --> 00:02:36.400
 assume that once this guy is

50
00:02:36.400 --> 00:02:41.000
 a processed. So once this financial transaction

51
00:02:39.200 --> 00:02:43.600
 is being made then the

52
00:02:42.600 --> 00:02:45.400
 balance is updated and the

53
00:02:45.400 --> 00:02:48.500
 balance is actually zero. Okay, let's assume something

54
00:02:48.500 --> 00:02:51.200
 like this. So when the balance is

55
00:02:51.200 --> 00:02:56.800
 zero here, we've got some really interesting condition

56
00:02:54.800 --> 00:02:57.800
 here because

57
00:02:57.800 --> 00:03:00.900
 the balance is right now zero, so

58
00:03:00.900 --> 00:03:03.700
 it basically means that well, I cannot

59
00:03:03.700 --> 00:03:05.900
 send more money from my

60
00:03:06.200 --> 00:03:07.700
Sound because the balance is zero.

61
00:03:08.300 --> 00:03:11.200
But please notice that there are

62
00:03:11.200 --> 00:03:14.900
 free money transfer requests that

63
00:03:14.900 --> 00:03:18.300
 have already been accepted.

64
00:03:17.300 --> 00:03:20.500
 So we've got really strange situation from

65
00:03:20.500 --> 00:03:23.900
 one point of view. The balance is zero. So no more

66
00:03:23.900 --> 00:03:27.200
 money should be you know, we've run

67
00:03:27.200 --> 00:03:30.100
 or transferred from my account but on the

68
00:03:30.100 --> 00:03:30.500
 other hand.

69
00:03:31.400 --> 00:03:34.700
Free and Money Transfer requests now have

70
00:03:34.700 --> 00:03:37.400
 already been accepted and this guys will

71
00:03:37.400 --> 00:03:40.700
 be processed even further because they have been accepted

72
00:03:40.700 --> 00:03:44.100
 before the balance went to

73
00:03:43.100 --> 00:03:46.300
 zero and this three guys here.

74
00:03:47.300 --> 00:03:51.000
Are actually responsible for stealing more

75
00:03:50.700 --> 00:03:53.300
 money from a bank. This is

76
00:03:53.300 --> 00:03:56.800
 actually how race condition works. Now. Let

77
00:03:56.800 --> 00:03:59.300
 me tell you one why we've got a race condition here.

78
00:03:59.300 --> 00:04:02.500
 Well indeed, we've got the race because the question

79
00:04:02.500 --> 00:04:06.200
 is like this how many threads are

80
00:04:05.200 --> 00:04:08.900
 gonna be accepted right

81
00:04:08.900 --> 00:04:11.500
 how many money transfer requests are

82
00:04:11.500 --> 00:04:14.300
 gonna be accepted before the balance

83
00:04:14.300 --> 00:04:17.600
 goes to zero. That's the question and the more

84
00:04:17.600 --> 00:04:20.700
 money transfer requests gonna be accepted before

85
00:04:20.700 --> 00:04:23.600
 the balance goes to zero the more money the

86
00:04:23.600 --> 00:04:26.400
 attacker can still from the bank,

87
00:04:26.400 --> 00:04:29.300
 right? This is how it works. This is a race who's gonna

88
00:04:29.300 --> 00:04:32.400
 be faster, right? And the number

89
00:04:32.400 --> 00:04:35.700
 of money transfer requests that

90
00:04:35.700 --> 00:04:38.200
 are gonna be accepted before the bonds goes

91
00:04:38.200 --> 00:04:41.200
 to zero. Well is is dependent on

92
00:04:41.200 --> 00:04:44.300
 many different things. That's why this attack

93
00:04:44.300 --> 00:04:46.900
 is non-deterministic what I mean,

94
00:04:47.200 --> 00:04:51.000
Here is that the network performance has an

95
00:04:50.200 --> 00:04:53.900
 impact on this attack the performance

96
00:04:53.900 --> 00:04:56.600
 of the machine where the web application is hosted.

97
00:04:56.600 --> 00:04:59.500
 It has also, you know impact on

98
00:04:59.500 --> 00:05:02.300
 this attack think about swapping right when we've got

99
00:05:02.300 --> 00:05:05.400
 a swapping on the machine where your web application

100
00:05:05.400 --> 00:05:08.500
 is hosted. It also has an impact of on this

101
00:05:08.500 --> 00:05:12.800
 attack and this attack is about concurrency multi-threading

102
00:05:11.800 --> 00:05:14.600
 and fractions of

103
00:05:14.600 --> 00:05:17.800
 milliseconds. So you see that this is indeed a

104
00:05:17.800 --> 00:05:18.000
 race.

105
00:05:18.700 --> 00:05:21.900
And yeah, now this is this is

106
00:05:21.900 --> 00:05:24.100
 how it works and I believe that this is clear for you.

107
00:05:24.100 --> 00:05:27.200
 But let me also tell you how to prevent it from

108
00:05:27.200 --> 00:05:31.100
 happening because this is also interesting. Well, what

109
00:05:30.100 --> 00:05:34.100
 we should do is we should

110
00:05:33.100 --> 00:05:36.500
 never accept the next

111
00:05:36.500 --> 00:05:41.000
 money transfer request before the

112
00:05:39.100 --> 00:05:42.600
 money transaction

113
00:05:42.600 --> 00:05:45.300
 request. The previous one is being finished.

114
00:05:45.300 --> 00:05:48.500
 Okay. So first what we should have is

115
00:05:48.500 --> 00:05:52.100
 this guy should finish then

116
00:05:51.100 --> 00:05:54.800
 the balance should be updated. And once

117
00:05:54.800 --> 00:05:58.500
 the balance is updated then we should accept

118
00:05:57.500 --> 00:05:59.800
 the new

119
00:06:00.400 --> 00:06:03.100
Incoming money transfer request right?

120
00:06:03.100 --> 00:06:06.400
 And then we are guaranteed that

121
00:06:06.400 --> 00:06:10.200
 race condition will not happen. So one

122
00:06:09.200 --> 00:06:12.300
 thread at a time when you

123
00:06:12.300 --> 00:06:15.900
 are here making a transaction then let's

124
00:06:15.900 --> 00:06:18.700
 do it. Let's finish it. Then let's

125
00:06:18.700 --> 00:06:21.900
 update the balance then check

126
00:06:21.900 --> 00:06:24.700
 the balance and then allow or

127
00:06:24.700 --> 00:06:27.500
 disallow the next fret the

128
00:06:27.500 --> 00:06:30.500
 next and Money Transfer request. Okay. So one

129
00:06:30.500 --> 00:06:33.600
 fret at the time only in the system would

130
00:06:33.600 --> 00:06:36.600
 prevent this attack from happening.

131
00:06:36.600 --> 00:06:39.200
 So I believe that this is clear for you. And if you

132
00:06:39.200 --> 00:06:42.400
 gonna implement this country measure then I

133
00:06:42.400 --> 00:06:45.700
 recommend you to implement actually the transactions

134
00:06:45.700 --> 00:06:49.000
 in the databases because this is gonna solve

135
00:06:48.700 --> 00:06:50.700
 your problems, okay?

136
00:06:51.700 --> 00:06:54.200
So I believe that this is clear for you.

137
00:06:54.200 --> 00:06:58.200
 Let me right now go to the slides and let

138
00:06:57.200 --> 00:07:00.000
 me wrap up what I presented here.

139
00:07:01.300 --> 00:07:04.700
So I used many concurrent requests.

140
00:07:05.400 --> 00:07:08.500
To transfer $10 from one

141
00:07:08.500 --> 00:07:12.000
 account to another account and I

142
00:07:11.700 --> 00:07:14.900
 presented to you that the

143
00:07:14.900 --> 00:07:18.100
 race condition happens when money

144
00:07:17.100 --> 00:07:20.800
 transfer requests are accepted

145
00:07:20.800 --> 00:07:24.000
 faster than financial transactions

146
00:07:23.200 --> 00:07:26.100
 are being made, right? This is what I

147
00:07:26.100 --> 00:07:29.500
 actually try to explain to you on the Whiteboard

148
00:07:29.500 --> 00:07:32.400
 and when the balance goes

149
00:07:32.400 --> 00:07:35.600
 to zero, there are still a

150
00:07:35.600 --> 00:07:39.300
 few money transfer requests already accepted

151
00:07:38.300 --> 00:07:41.500
 once that are waiting

152
00:07:41.500 --> 00:07:44.500
 to be processed. So this is how

153
00:07:44.500 --> 00:07:47.300
 we can actually still money from

154
00:07:47.300 --> 00:07:50.700
 a bank via race condition. And finally

155
00:07:50.700 --> 00:07:53.100
 I presented to you, you know,

156
00:07:53.100 --> 00:07:57.600
 a kind of high level overview of the Canter measure for this

157
00:07:56.600 --> 00:08:00.100
 attack because you definitely don't

158
00:07:59.100 --> 00:08:02.500
 want this attack to have an impact

159
00:08:02.500 --> 00:08:04.900
 on your own systems. So I also

160
00:08:05.300 --> 00:08:08.600
Question transactions and how to fix the the problem

161
00:08:08.600 --> 00:08:11.400
 that I discussed here. Okay. So I believe

162
00:08:11.400 --> 00:08:14.300
 that you really like this case and you see the

163
00:08:14.300 --> 00:08:17.700
 power of race condition exploitation. So we

164
00:08:17.700 --> 00:08:21.700
 are right now done with this case and in

165
00:08:20.700 --> 00:08:23.200
 the next one in the case number

166
00:08:23.200 --> 00:08:26.400
 two, I will dive even more into race

167
00:08:26.400 --> 00:08:29.600
 condition exploitation and we're gonna have even more fun

168
00:08:29.600 --> 00:08:32.700
 with this kind of attack. So yeah, we

169
00:08:32.700 --> 00:08:35.500
 are done with this case. So let's right now jump to

170
00:08:35.500 --> 00:08:36.000
 the next one.
