Instructor: Okay, now let's have a look 2 2
on a stored XSS example. 3 3
Now, stored XSS is very similar 4 4
to a reflected one. 5 5
It allows you to inject JavaScript code 6 6
into the browser. 7 7
The code is executed on the people 8 8
that visit the page. 9 9
The only difference is with the reflected, 10 10
you have to send the URL 11 11
to your target so the target had to actually click 12 12
on a URL for the exploit to run 13 13
or for the code to run. 14 14
In the stored XSS, 15 15
the code will actually be stored into the database 16 16
or into the page. 17 17
So every time any person runs that page, 18 18
they will see your code and your code will be executed. 19 19
So you won't need to interact with any users 20 20
or send them anything. 21 21
Therefore, this could be much more dangerous 22 22
than reflected XSS. 23 23
So let's have a look on this. 24 24
Now, I clicked on the XSS stored here on the left 25 25
and you have this page. 26 26
And this page just allows you 27 27
to add a message to the system. 28 28
So I'm gonna put my name as Zaid. 29 29
We're just gonna do a normal test first 30 30
and we're gonna put a message body, for example, 31 31
and then I'm gonna sign the guestbook 32 32
and you can see that Zaid added a message 33 33
called message body. 34 34
So if we go to here 35 35
into another machine. 36 36
So this is a different machine 37 37
to a different place 38 38
and if we go into the XSS stored, 39 39
we can see that there is two entries. 40 40
So the entries are being loaded from the database 41 41
and they contain the entries in that database. 42 42
So if we manage to inject code in here, 43 43
then any person who runs this page, 44 44
the code will run it 45 45
without even having to send that person anything. 46 46
So let's try to inject stuff here. 47 47
So let's put my name as Zaid 48 48
and I'm gonna try to put my code in here. 49 49
So I'm gonna try to inject into the message. 50 50
I'm gonna put it as script. 51 51
I'm gonna use the exact same test code 52 52
that we used in the previous video. 53 53
Just a message saying XSS. 54 54
Again, very basic code. 55 55
But it serves for the purposes of this video 56 56
and we're gonna say alert 57 57
XSS. 58 58
And I'm gonna try to sign the guestbook 59 59
and as we can see now, I got the XSS here. 60 60
But the real magic happens 61 61
when a normal person, 62 62
so let's just go home first 63 63
and let's assume this is just a normal website 64 64
and people are just coming and browsing it 65 65
and once they're gonna go to the guestbook, 66 66
JavaScript code will be executed on their system 67 67
from that website. 68 68
So the code is coming from that website 69 69
and it's going to be executed on every person 70 70
that visits this page. 71 71
Again, we're just showing a proof of concept here. 72 72
In future videos, we'll show 73 73
how to further exploit this kind of vulnerability.