WEBVTT - This file was automatically generated by VIMEO

0
00:00:13.100 --> 00:00:15.100
Hello and welcome to this lesson.

1
00:00:15.800 --> 00:00:18.800
In this lesson, we are going to understand about race conditions.

2
00:00:18.800 --> 00:00:21.200
 The race conditions are amazing.

3
00:00:22.400 --> 00:00:25.800
We can definitely identify these category

4
00:00:25.800 --> 00:00:28.700
 of vulnerabilities on web applications, which could

5
00:00:28.700 --> 00:00:31.700
 lead to business logic issues as well.

6
00:00:32.500 --> 00:00:35.500
And we all know that business logic issues are

7
00:00:35.500 --> 00:00:39.000
 generally least identified by security researchers

8
00:00:38.300 --> 00:00:41.000
 and Bug bounty hunters because they are

9
00:00:41.600 --> 00:00:42.400
 sometimes harder to test.

10
00:00:43.400 --> 00:00:46.300
But with the help of nuclei we can

11
00:00:46.300 --> 00:00:49.200
 indeed test for race conditions as well.

12
00:00:50.100 --> 00:00:53.100
So we are going to learn that how you can write your own

13
00:00:53.100 --> 00:00:56.600
 template that can help you assist in testing

14
00:00:56.600 --> 00:00:59.500
 for race conditions. If a web application has

15
00:00:59.500 --> 00:01:01.800
 been vulnerable to this vulnerability.

16
00:01:03.800 --> 00:01:06.600
So race conditions is when multiple threads read

17
00:01:06.600 --> 00:01:08.100
 and write the same variable.

18
00:01:09.400 --> 00:01:12.500
A very very common example is while using a coupon code

19
00:01:12.500 --> 00:01:15.400
 which only has a one-time validity.

20
00:01:17.100 --> 00:01:20.100
For example, if you have a coupon code of $10,

21
00:01:20.100 --> 00:01:23.500
 and if you are able to redeem it 10 times you

22
00:01:23.500 --> 00:01:27.000
 have hundred dollars added into your account. Now

23
00:01:26.400 --> 00:01:30.000
 this directly impacts the organization and

24
00:01:29.600 --> 00:01:31.900
 create a business loss.

25
00:01:33.300 --> 00:01:36.600
So raise conditions can be implemented using gate mechanism.

26
00:01:37.800 --> 00:01:40.600
Example turbo Intruder in Pursuit as

27
00:01:40.600 --> 00:01:40.700
 well.

28
00:01:42.300 --> 00:01:45.300
Now we are going to see in the Practical time

29
00:01:45.300 --> 00:01:48.400
 that how you can quickly write a template that can

30
00:01:48.400 --> 00:01:51.100
 assist you in identifying race conditions.

31
00:01:53.100 --> 00:01:56.100
So let's quickly go to the Target first.

32
00:01:57.400 --> 00:01:58.500
As you can see over here.

33
00:01:59.400 --> 00:02:02.600
The target is test restart PHP.

34
00:02:04.100 --> 00:02:06.600
Here you have to enter the coupon code.

35
00:02:07.400 --> 00:02:10.400
Once you enter the coupon code correctly you are

36
00:02:10.400 --> 00:02:11.600
 able to redeem it.

37
00:02:12.800 --> 00:02:15.700
So I have written a race condition template

38
00:02:15.700 --> 00:02:19.100
 that will help us in checking if

39
00:02:18.100 --> 00:02:21.400
 the target is vulnerable to raise condition or

40
00:02:21.400 --> 00:02:21.800
 no.

41
00:02:23.900 --> 00:02:26.500
So the template is race condition dot. Yml,

42
00:02:26.500 --> 00:02:28.000
 this is the ID block.

43
00:02:30.900 --> 00:02:32.600
Next is the info block.

44
00:02:34.200 --> 00:02:37.900
Next is the request block which contains the method as

45
00:02:37.900 --> 00:02:40.900
 post as we want to send a

46
00:02:40.900 --> 00:02:43.400
 coupon code and check if it is valid or

47
00:02:43.400 --> 00:02:43.500
 no.

48
00:02:44.300 --> 00:02:47.600
This is the path in which we are specifying the base URL

49
00:02:47.600 --> 00:02:50.400
 and this is the endpoint where we want to redeem our

50
00:02:50.400 --> 00:02:50.800
 coupon.

51
00:02:51.500 --> 00:02:55.100
In the body, we have supplied the coupon code AS hackify 10

52
00:02:54.100 --> 00:02:57.700
 CS maybe to redeem $10.

53
00:02:57.700 --> 00:03:00.700
 We are supplied race as true.

54
00:03:01.500 --> 00:03:05.100
Which means we want to perform race condition testing and

55
00:03:04.100 --> 00:03:07.200
 race count as 10, which means

56
00:03:07.200 --> 00:03:10.600
 we want to send 10 simultaneous request

57
00:03:10.600 --> 00:03:11.200
 together.

58
00:03:12.100 --> 00:03:16.300
In the magic condition, we are expecting a response of

59
00:03:15.300 --> 00:03:18.400
 a status code. That is 200. Okay

60
00:03:18.400 --> 00:03:20.600
 and based on this we would match it.

61
00:03:21.200 --> 00:03:24.800
You can also add matches condition which says

62
00:03:24.800 --> 00:03:28.600
 redeem successful or successful as

63
00:03:27.600 --> 00:03:29.100
 well.

64
00:03:30.200 --> 00:03:32.000
Let's save this template quickly.

65
00:03:33.300 --> 00:03:35.400
Let's go to our terminal.

66
00:03:37.000 --> 00:03:37.200
here

67
00:03:38.100 --> 00:03:41.100
we are going to say we want to send this request.

68
00:03:43.700 --> 00:03:45.300
That template name that we have.

69
00:03:46.500 --> 00:03:48.900
written so nuclei

70
00:03:49.900 --> 00:03:52.800
We have specified our Target URL the

71
00:03:52.800 --> 00:03:55.500
 template that we have just written which is race

72
00:03:55.500 --> 00:03:59.000
 condition Dot, yml and hyphen V observe very

73
00:03:58.000 --> 00:03:59.700
 carefully.

74
00:04:00.600 --> 00:04:01.600
When I hit enter.

75
00:04:02.600 --> 00:04:05.600
The request has been sent simultaneously if

76
00:04:05.600 --> 00:04:09.400
 you can look over here the timestamp if

77
00:04:08.400 --> 00:04:12.300
 you look carefully at the timestamp, the

78
00:04:11.300 --> 00:04:14.900
 timestamps are exactly the same

79
00:04:14.900 --> 00:04:17.800
 that means 10 simultaneous request

80
00:04:17.800 --> 00:04:21.200
 was sent together to redeem the

81
00:04:20.200 --> 00:04:23.200
 coupon from which you can see

82
00:04:23.200 --> 00:04:27.100
 these many requests were successful these

83
00:04:26.100 --> 00:04:29.100
 wooden successful. The next

84
00:04:29.100 --> 00:04:32.600
 ones were also successful. So the verb

85
00:04:32.600 --> 00:04:35.500
 application if allowed us to redeem

86
00:04:35.500 --> 00:04:38.500
 the coupon we could have redeemed it multiple times.

87
00:04:39.400 --> 00:04:42.700
I hope you guys understood how you can use the race

88
00:04:42.700 --> 00:04:45.500
 condition feature in nuclei by writing

89
00:04:45.500 --> 00:04:49.000
 a custom template like this that can

90
00:04:48.700 --> 00:04:52.100
 assist you in identifying business logic

91
00:04:51.100 --> 00:04:54.900
 issues on bug Bounty program as well. Thank

92
00:04:54.900 --> 00:04:55.000
 you.
