1
1

00:00:00,480  -->  00:00:01,890
<v Instructor>Clickjacking.</v>
2

2

00:00:01,890  -->  00:00:03,750
In this lesson, we are going to talk about
3

3

00:00:03,750  -->  00:00:05,850
the dangers of clickjacking.
4

4

00:00:05,850  -->  00:00:07,950
Clickjacking is a type of hijacking account
5

5

00:00:07,950  -->  00:00:10,770
that forces a user to unintentionally click a link
6

6

00:00:10,770  -->  00:00:14,010
that's embedded in or hidden by other webpage elements.
7

7

00:00:14,010  -->  00:00:15,930
For instance, let's say I was playing a video game
8

8

00:00:15,930  -->  00:00:17,880
and there's a big play button, and I don't see
9

9

00:00:17,880  -->  00:00:20,190
that behind that, there's actually a pay button
10

10

00:00:20,190  -->  00:00:21,990
and if I click that link for play,
11

11

00:00:21,990  -->  00:00:23,580
I'm not actually clicking the play button.
12

12

00:00:23,580  -->  00:00:26,220
I'm clicking this hidden layer that says pay
13

13

00:00:26,220  -->  00:00:27,750
and that's going to charge me.
14

14

00:00:27,750  -->  00:00:30,000
This is the idea of using clickjacking.
15

15

00:00:30,000  -->  00:00:32,220
Clickjacking is used when a victim clicks the link,
16

16

00:00:32,220  -->  00:00:33,720
they can be redirected to what appears
17

17

00:00:33,720  -->  00:00:35,400
to be a legitimate page as well.
18

18

00:00:35,400  -->  00:00:36,660
For instance, I click on something,
19

19

00:00:36,660  -->  00:00:38,610
it takes me something that looks like a login page.
20

20

00:00:38,610  -->  00:00:41,250
I enter my username and password, and low and behold,
21

21

00:00:41,250  -->  00:00:42,840
I didn't really log into my site.
22

22

00:00:42,840  -->  00:00:44,850
I just gave them my username and password.
23

23

00:00:44,850  -->  00:00:46,680
This is another form of clickjacking
24

24

00:00:46,680  -->  00:00:49,080
and another reason you have to be on the lookout for it.
25

25

00:00:49,080  -->  00:00:50,880
Now, clickjacking is made possible
26

26

00:00:50,880  -->  00:00:54,030
because of the use of iframes within HTML.
27

27

00:00:54,030  -->  00:00:56,340
Essentially, because of these iframes that are allowed
28

28

00:00:56,340  -->  00:00:58,230
within HTML, you can actually have
29

29

00:00:58,230  -->  00:01:00,780
invisible iframes that's accepting the values
30

30

00:01:00,780  -->  00:01:02,010
when you're inputting your credentials
31

31

00:01:02,010  -->  00:01:04,140
even though you don't see it on the screen.
32

32

00:01:04,140  -->  00:01:05,490
It's really, really tricky,
33

33

00:01:05,490  -->  00:01:08,400
but it is something that can be done through clickjacking.
34

34

00:01:08,400  -->  00:01:10,170
Now, one way to prevent clickjacking
35

35

00:01:10,170  -->  00:01:12,150
is by using frame busting.
36

36

00:01:12,150  -->  00:01:14,190
Now, frame busting is a technique that removes
37

37

00:01:14,190  -->  00:01:16,102
the malicious iframe loaded on the site
38

38

00:01:16,102  -->  00:01:19,140
by forcing your page to the top frame
39

39

00:01:19,140  -->  00:01:21,630
'cause essentially, think about this like layers.
40

40

00:01:21,630  -->  00:01:23,730
If they have a clickjacking on your site
41

41

00:01:23,730  -->  00:01:25,650
and they have an invisible layer on top,
42

42

00:01:25,650  -->  00:01:26,820
people are entering it on there
43

43

00:01:26,820  -->  00:01:28,680
even though they think they're on your site.
44

44

00:01:28,680  -->  00:01:31,080
By taking your site and forcing it to the top,
45

45

00:01:31,080  -->  00:01:32,545
that's going to make sure they're always inputting data
46

46

00:01:32,545  -->  00:01:36,120
in your site and not on the clickjack site.
47

47

00:01:36,120  -->  00:01:37,410
Now, one of the ways to do this
48

48

00:01:37,410  -->  00:01:39,990
is by using just a simple bit of JavaScript.
49

49

00:01:39,990  -->  00:01:42,480
For instance, if top does not equal self,
50

50

00:01:42,480  -->  00:01:45,510
then self location equals top location.
51

51

00:01:45,510  -->  00:01:47,280
This takes your layer and puts it on the top
52

52

00:01:47,280  -->  00:01:48,780
to prevent clickjacking.
53

53

00:01:48,780  -->  00:01:50,190
Now, this will only work against
54

54

00:01:50,190  -->  00:01:51,750
the most simple framing abuse,
55

55

00:01:51,750  -->  00:01:53,610
but it is something good to put in there.
56

56

00:01:53,610  -->  00:01:56,220
There are more advanced iframe attacks that could use
57

57

00:01:56,220  -->  00:01:59,010
more advanced countermeasures using JavaScript as well.
58

58

00:01:59,010  -->  00:02:01,710
For instance, you could use X-Frame-Options.
59

59

00:02:01,710  -->  00:02:04,650
If you set your X-Frame-Options and set them to deny,
60

60

00:02:04,650  -->  00:02:06,000
this is actually a better strategy
61

61

00:02:06,000  -->  00:02:07,740
to protect against clickjacking.
62

62

00:02:07,740  -->  00:02:09,690
Now, when you do this, you have to make sure
63

63

00:02:09,690  -->  00:02:11,070
that this is in the header
64

64

00:02:11,070  -->  00:02:13,200
and deploy to every page in your domain.
65

65

00:02:13,200  -->  00:02:15,270
If you don't do that, then the clickjackers
66

66

00:02:15,270  -->  00:02:16,260
still have a way in
67

67

00:02:16,260  -->  00:02:18,683
and they can still take advantage of your customers.
