1.2 What is XSS, Types of XSS, and Prevention

Video Activity
Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *

Already have an account? Sign In »

40 minutes
Video Transcription
Hi, everyone. Welcome back to the course. So in the last video, we talked about the overall course objectives. So we talked about that. We're gonna learn what crossing scripting is. We'll also talk about the different types of cross site scripting, and we're gonna have some hands on labs. We also talked about the core structure in general. So again, there supplement of resource is for you. Make sure you click on the resource is tap and download those.
And then we went over my background. Is your instructor
in this video where to go ahead and talk about will Cross site scripting is as well as the different forms of it.
So quick pre assessment question here. Ah, penetration tester runs a following and map command against the client systems. What's the purpose of this command? And I'll give you a hint that there's a hint in this particular command.
So it's gonna be a this command. Carl's websites with Google Spider on Port 80.
It's gonna be be this command runs a denial of service and Web attack using cross site scripting. Is it gonna be? See this command test for Dom base cross site scripting vulnerabilities Or is it gonna be D? This command runs a Power shell script against Traffic Import 80.
All right. As I mentioned, there was a hint in it. So if you see there where we run the script, it says, Don base. So that was your hint right there that we were looking for Dom Base, which is Answer C.
So if he kills Answer. See, you are correct.
So are learning objectives for this video. We're gonna learn what cross ex scripting is. We'll talk about what it is. Well said. I learned the different types of cross site scripting.
So what is cross site scripting? Well, generally speaking, it's usually client signed. Reflected as well. Talk about a little bit is the more common version of it. But there is a stored version of it that someone could, for example, take over a Web page or take over the Web server and inject malicious code. And that way, every single person coming to that page will get reinfected.
So, as I mentioned, a script is generally run. It's normally is targeted towards browsers, so that again the most common format you'll see and specifically trying to steal like cookies or session tokens and a tool that we're gonna use actually, in our one of our labs is gonna be a tool called Beef Will use that briefly
and again plugging Joe periods. You'll see that I plugged him several times throughout this course.
He's got a breaking stuff with Joe Siri's video on beef, so make sure you check that out as well in the catalog.
Now, before we jump into the different types of cross site scripting, I just want to mention
I want to show you a quick article regarding Attackers doing this on eBay. So what they did is they did cross site scripting attacks inside of eBay listings. This kind of an older article, but the is probably still out there and use an eBay just hasn't found it yet. I'm actually shocked that people still use today, but
I think a lot of people out there still do. I'm just one that doesn't so let's jump in to take a look at that real quick, and then we'll move on with talking about the different types of cross eyed scripting.
All right, so here's the article by Net craft again, it's it's talking about a little older thing is talking about it back in 2017. But as you as you probably know, many Attackers are still using old stuff and still exploiting stuff. So I would imagine that eBay still has his vulnerability in some capacity and it's still being exploited. We just are not aware of it.
So basically, you could read through the article I've elected in the supplement of resource is section for you. But essentially, Attackers were using cross site scripting and putting out listings s o that way as you as a user. As you clicked on the listings. Who would infect you with the cross? That scripting attack so you can scroll through the article, read through it. We're not going to read through it here. I just want to briefly show you this as one example.
I've been also some older examples as well. Across site scripting, you think about like the Sony attack
and stuff like that. We've got many examples out there, of course, site scripting into use. So again, it's pretty popular attack, as far as a reflected aspect of it stored is ah more dangerous formals kind of talk about that as well. And then Don based is not as common again in just a little bit. Will be talking about those.
All right, So now let's talk about the different types of cross site scripting, so we have stored. Or as it's more commonly called persistent, we also have reflected, which again, is the most common one. And then Dom based
so stored across the scripting is again the most dangerous one. So this one's gonna keep re infecting s, oh, kind of like some STDs or if you don't know what that is, sexually transmitted diseases. Some of those keep re infecting people so similar to something like that, not, as you know, not as dangerous to a human body.
Definitely dangerous to computer body
in that aspect. So they keep re affecting you. So, for example, like a Web page might be affected or Web server and you keep going to that and every single person going to that gets infected,
you'll find this commonly, like our forums,
that sort of stuff. You'll find a lot of these types of the stored excess s attacking like different forums and again when pages that are compromised
reflected cross end scripting as I mentioned before. It's the most common form simply because a lot of times they're just changing the Earl s o for you. See an example here where we change the last part of the U. R l to add in the script of whatever we want to run. Now this one obviously is just gonna jump up and alert box that tells us you've been attacked,
but otherwise it could be infecting our machine. The downside of that is from an attacker standpoint, Is
wants to use her, like, closes that Web page or clears her cookies.
I don't have that attack anymore, right? They have to, you know, I have to re attack them. That's where store it comes into play because we can keep re infecting them no matter what they do, right. If they clear their cookies, other browser, they're still gonna come get attacked.
And then Dobby basis is not is common
just because it takes a little more work and also because things like for it za Java script thing. But for example, like angular Js, it's got built in production against on base attacks, so you'll see that more recent websites or updated with states are not necessarily gonna be is vulnerable to this type of attack.
So how do we prevent it? Well, we could separate on trusted data. So you know the client side input data, the script, basically, that's that's going to be running. If that's not validated, then that's what basically allows the attack to occur. So if we separate that untrusted data and say, Wait a minute, you know, we don't know what this is
they did not run it. Then we could potentially prevent against this type of attack. Also, as I mentioned, using frameworks that escape across that script ings with frameworks with built in protection, like angular dot yes, also escaping on trusted http requests clearing our cookies get for reflected cross site scripting attacks that will help with that
and that you're developing a conscience security policy.
So a court post assessment question here David's concerned about cross site scripting attacks and understands that cross that scripting attacks are typically targeted towards which of the following.
I want you to choose the best answer here because there are several answers that could be correct, which used the best one of these. So it's gonna be a
you know, clients. Be users. See cookies or D Web browsers.
If you guessed answer D Web browsers, you are correct. So again, cross that certain scripting attacks are typically targeted towards Web browsers in some capacity. But you'll notice there that we could have answered cookies for user's. Those were both kind of correct, but the best answer there was Web browsers.
All right, so in this video, we just briefly talked about what cross site scripting is. We talked about the different types of cross site scripting as well as some different ways, and we could potentially prevent against cross site scripting attacks
in the next module. We're gonna jump into our laps. So in the next video, we're gonna jump into a simple example of a cross site scripting reflected attack.
Up Next