5.1 XSS

Video Activity
Join over 3 million cybersecurity professionals advancing their career
Sign up with

Already have an account? Sign In »

14 hours 43 minutes
Video Transcription
Hello, everybody. Welcome to the episode number 18 off the RCP course.
Gross. I script in
my name is Alejandro Gonna and I'll be your instructor for today's session.
The learning objectivity is to understand the concepts behind this attack. And, you know the cross site scripting attack and apply to makes to implement across a script in a text will.
So let's get down to business, shall we?
First let me start by, you know, giving you some background of the chrysalis krypton attack. You know, this crisis gripping our X S s attacks are the type Are you know, some kind of injection in which my leash use scripts are injected into?
You know, I'll trust that websites if you like.
Chris, I script in tax accord. When an attacker, he uses away application input. Like, you know, search search box is common sections
to send or insert a malicious code.
You can imagine that a script or code will be executed by anybody trying to access that webpage. You know, flaws that allow these attacks are to succeed are quite, you know, easy to find because there, there, there, you know,
there's a lot of this building of lettuce on there or several Web pages around the world. Unfortunately,
you know, the in this case, the end user's browser has no way to know that the script should not be trusted because the school will be executed in a context where the webpages trusted. For example, you already performed the T. L s handshake
against the server. You already know that you're that's the server you're actually
trying to access. You know, maybe any commerce server. You're just trying to buy a T shirt or something like that. And you know that you already trust your browser Already trust in that server. There's no way to know that
that the malicious the script or malicious card is should not be trusted. So you know this. The script will be executed.
Now they're t treat three types. Of course, I script in tax. The 1st 1 I guess, is the most faithful famous one is disturbed Cross. I scripted
Mr Present script in
general area court cars when Caesar inputs
Ah, it's a start on the target server. You know, you put a malicious script
Ah, in common section so this could be saved in a database or you know, in the weapons itself,
Uh, you know, and you then
can retrieve information from any victim actually trying to access that webpage, for example, a cookie credentials. You can actually redirect that to another Web? H r. You know, perform any kind of delicious stuff.
The second type of precise krypton attack is there reflected precise krypton,
Or, you know, you can also finding us not non persistent. Chris, I script in tech.
This attack happens when the user inputs.
Um, you know what? Whatever the user inputs is returned by the web page a semester message, you know, search results or something like that.
You know, this is not kind of so common to use. You know, this is Sonal, a type, and the 3rd 1 and final is the down based
Chris as Krypton taik. You can also find it a stipe zero attack.
This is a form of precise written word. Entire data flow from serves to the sink takes place in the browser,
for example, that the breath officers of the data is in the dumb file. This thing, it's also the dumb file. Or don message the message. I'm sorry on the data flow never leaves the browser. So, you know, this is kind of what happens
in this tree. Different type of Chris I script in attacks. So let's see a practical example of that of the precise scripting attack in this case, I'm store based process Krypton attack.
So, uh, you remember we already have our web beach, but let me just show you here. We already have. Ah, Debbie in server running
just up in the browser type the peep Davian
because he has a really simple page has ah, common section has, uh, you know, to come in sections has an admin lug in which we don't have the password, by the way, um, so yeah, us. I told him for you can, uh,
as we're going to see a store. Chris, a script in attack.
You can actually try importing some basic comments. For example, just thio. See if this is actual invulnerable. Let me just type here test. And, for example, we can just start a script here, Script
alert and just look launch on alert, for example, cross site scripting
and just close the script.
A simple is that, um And as you can see, every time someone actually strained trying to access this, that the Lord will lunch. Um,
the problem is that, you know, this is not that malicious at all. Ah, but, you know, you can imagine you can do a lot of much stuff. You know, this is the browser I have in my column machine. But I have a next P machine running right here. And, you know, if I go to the er
to the home, I see this one comment in the welcome page. So if I go here, you can see the message the message launched saying, Chris, I scripted as we instructed, This is kind of, you know, trying to be like the victim of this attack
because, you know, here's the attacking machine, which is the server.
Ah, but
we already have the victim machine.
Uh, right here.
So But what happens if I wanted to do something more? Militias like stealing a cookie? Uh, I already have ah scraped running on the debian server side,
you know it. It tries to be like
some administration. I'm in straighter. I'm sorry.
Logging into the web h so we can, you know, try to mimic some someone trying to access the weapon to write about a valid credentials. So that's the assumption here. Just just so you know. So
we already have our or script here, but we can insert another comment that's too just to
And, um,
let me just copy Paste, um, that this script and I will split into you.
So this really simple script which, you know, you will write a document, and in this case, the document will be the cookie, and it will send it Thio, my listening server. I will open a port and, um, I will open a listener import 35 35
and that's it may not know that complicated at all again. The assumption is that in the Davian server, which you know, this weapon she's located there. So I have a simple script running which is trying to mimic on administration administrator long it into the weapon. So we will have a Bali cookie
that you know what's created due to ah barley Le Guin
at the service side,
and I inserted. And as you can see, there's another coming in here, So I now have to just up in a listener. So we can actually get the cookie back to us. I can use net cut or uncut. Ah, but it will die after we received the first cookie. Maybe
we're waiting for in a specific
cookie created from a specific I p R O R machine. So I like for these can implications. I like to use the python module, which is called http server. So we'll just type here python tree
dash m
tp that server. And as you remember, we put 85 85 we'll be listening for cookies
in the sport, eh? So we'll wait for a while. But, you know, meanwhile,
as you can imagine, we can also create, actually perform other malicious stuff
like, for example, ah, Red directing the user to a different webpage or, you know, using any type of malicious stuff. But, you know, I'll show you to you later in this video. So for now, we just copy the cookie and remember, we don't have access to admin,
but, you know, we can change that. So I just go to a cookie manager Plenty. And I'm I used this one, but you can use whatever you feel comfortable with and just you know, replace the cookie with the values when
saved, you know, close or whatever. If I go to at me and I don't need the bodies work anymore, I really have, you know, about the kicky which was created from a valley Le Guin. So you can see how dangerous could be. This could be,
the other thing that we can actually do is to let me just go to home here is to actually read Eject that. Look out If I go to at me and the cookies No, no longer ballot.
You know, we expect that the other thing we can do is do actually ing meanwhile, are serious evict cookies.
Uh, the other thing that we can do is to redirect again
the user thio down, look or debate them to download and specific file. I want,
uh, let me just copy paid the script here. Now we'll split it to you.
Uh, in this case, I'm just created a document, you know, put in a link and then going thio whenever this document gets loaded or, you know, someone actually enters to that weapon, you will redirect to that
document That, except this documented except contains about dirt. I mean, a river Shal how to create that is Ah, we'll see that later in other medias.
But, you know, we already created that. And there's your server. You go here,
you just copy. Paste out me here.
If you actually go here, you will see that the document will be download is already created. And I put it into my web ***
and just download link, you know, and that's it.
anyone actually trying to go here, you know, it will be redirected to that weapons. So I'm just using my windows victim here. And if I go to welcome. Okay, Chris, I scripted. And it will, as you can see, the doctor me with glee that that X ray will be downloaded.
So we can actually,
now you can imagine the victims are I mean, I already I use are executed on file, but you can imagine doing the same with a pdf file. Ah, word or excel file. You know, whatever. And the victim, if the victim Mrs Actual expecting something like that like you can,
pretend to be this their CEO or something like that telling that to open the pdf Because
there's information about the last quarter sales numbers or something like that. The victims will often open it without any doubt. In this case, I just read it and are executed a file just to show you guys. But you can put that in more
usual four month for you.
So just let me just stop. Go here and start listener, you know, simple medical listener.
And 44444 if I remember correctly. And if I go to the big time here and I just ah, execute this, okay, Run. Whatever.
You can see that. Actually, we already have a reverse shell and all. The victim was doing this surfing the Web based, Remember, there's no suspicious thing about it. I mean, the Web server was the same words that the Web server, the I P or the Ho's name didn't change at all.
And I really have a bag Dirt. Ah, river shell
if you want.
you know, just to show you
I can already that the guy p and you know
what can I tell you? Huh? Nets that
yes, to show.
Oh, what? It wasn't that.
And to show you how the injuries could be.
Just give me
eyes. This decline based or a server race attack. Well, even though we actually target the server, but because we're uncertain the server, the script on server, the effective ones are declines. This could be true for, you know, store base. Remember there three types of tack,
Mr Burt. Mr. Bae's referred to reflect the base and Dom based tax.
Ah, we can also target declined directly. Uh, you know, the most common Guan is the one that is to target the server and declines defected one.
Can we actually gained remote controlled through this attack? Yeah, we can. I mean, we just showed I just showed you that you can, you know, by true, maybe social engineer or, you know, just in certain that in the weapons, the victims who already trust in that in that web server, Well, uh,
download and up in any file,
you're attached to it,
we'll learn a bit of summary. We learn the concepts of this attack, and we implemented into the Thompson next to secure this attack. And we saw how malicious they said That can be,
uh, you know, you can check the hacker playbook. A tree? Actually, you can use that book as reference for these complete module. Ah, this attacks are you? No mention it in that book. And I think they're really great book off, bro.
And, you know, as you can also see all of these attacks of this martial every possible source on Google and YouTube, it will be useful for you.
Uh, looking forward in the next video will cover SQL injection
That's it for today, folks. I hoping you're the video and talk to you soon.
Up Next
Offensive Penetration Testing

This is a deep course about penetration testing. In this course, you’ll learn from basic to the most advanced and modern techniques to find vulnerabilities through information gathering, create and/or use exploits and be able to escalate privileges in order to test your information systems defenses.

Instructed By