Let us continue with Exercice attacks in the previous two videos, we saw how to exploit the cross site
scripting vulnerability at a low level and medium level attack.
But in this lecture, we will see the exploitation of excesses at a high level and this level of security
you can expect in our websites.
But before moving that, we should have a brief knowledge of JavaScript events.
Now, what are the evening's events?
Are actions or occurrences that happen in the system?
In the world of programming, Actimel events are something that happens to the human elements.
But when JavaScript is used in e-mail pages, it can react to these events.
In this article, we will see what are the different types of events in JavaScript and how do they work
in the following sequence.
So what are events in?
JavaScript has events that provide a dynamic interface to the page.
These events are connected to elements in the form of document object model that is done.
Also, these events by default, use the bubbling propagation that has appeared in the dorm from children
to parent.
What are the different types of events in JavaScript?
There are different types of events in JavaScript that are used to react to events.
Now we will have a look at the following events on Klick.
What is an unclick?
Even the unclick event is a mouse event and provokes any logic defined.
If the user clicks on the element, it is bound to.
Now we'll have that is an error on error event is an event which reacts when there is something error
happened in loading the Web page or understanding the message supplied by the user, which means that
whenever an error message is passed, the event will get executed.
Then on Kallick even is we have seen unclick even.
Law, even the law even is invoked when an element is loaded completely, so the function of these events
is whenever something happens, then the event is generated, for example, on about the honor, what
even is evoked when something or the program or the Web page is awarded completely.
On Blu, even on change, even on play, even on key press, even now, what is on key press, even
in all key press event, something happens when the value or the script is changed.
So an example of one click event is on Kypreos.
It basically triggers when a key is pressed and released so attackers can make use of such events to
generate and hack systems.
For example, if the writers javascript saying that whenever an user presses Elche s under keyboard,
this event will take them to the malicious website.
So when let's say a person called Sam and told his name and whenever he presses and releases it, the
hacker probably has inputted that on key presses.
Take the user to malicious website.
Some will directly get directed the malicious websites.
In these ways, these JavaScript events are also used to exploit Accessors vulnerabilities.
Let us see how these events are used now.
Login to your machine and start the DV w e which we have already installed in the machine.
We will not use the machine this time.
Also, let us see how to exploit the JavaScript accesses vulnerability at the high level.
So right now, I'm in my living machine and you have to go to the security level and set the security
level too high, click submit and then let us try as reflected.
Now, here it is, asking us to exploit the vulnerability now, since we know that this is a high vulnerability,
we won't keep on trying.
The injection will try the previous script that we had inserted that is Xerces Alert and in which the
characters are in order.
So let's click submit and there you go.
It has removed all the script characters before moving and before.
Let me telling you what is the exact line.
I would first like to review the call.
So this is how the code looks like now, what it is saying, so you can see get input, replace that
argument, replace, slash, open bracket, everything, everything with a dash.
So you can see it is literally no.
What is the exact meaning if you can see this is dark.
So if the input or the code finds that there is a backslash, it will remove it.
Now here the bracket starts opening brackets here and there is no closed bracket.
And that is why in our output we got here the closed bracket because it wasn't removing that bracket.
So if you go to court again, dot s, which means everything after small errors should be completely
erased.
Everything after S should be completely erased.
Everything before and after C should be completely erased, no doubt.
And Star stands for basically everything.
Everything should be removed.
And that is why it removed the script.
Also.
But how do I pass this now, and that is why we have seen the theory of unclick even now in this case,
we are going to use the on error event to load an image whose address is not specified.
So I will take the call will type.
Image.
So is equal to X.
On.
Error is equal to alert.
Document, dot, cookie.
And then I could close the gap.
Now, what does this code means?
So what I'm trying to do here is I'm trying to lower the image here, OK?
I'm trying to lower image.
Now, you point out that it was remove this.
OK, OK, let remove.
But I will say it won't remove because it is only doing it for script.
So what I'm trying to do here is I'm trying to load an image whose source I haven't defined, OK, whose
source is X, which means no, and therefore the code will generate an error.
But what I'm generating in place of error is alert document dot cookie.
Now I am expecting that after generating this error, I would get to know the document.
That is the session I will hit submit and there you go.
We have the position in the US, so basically you can see the image is not loaded and therefore find
the image did not load because the code did not find the correct address.
And since there was no address system, thought that it is error.
But what we had told on error generate an alert.
Therefore the excess volatility is successfully exploded.
Now, this is the major trick used by security experts when they are trying to identify Xerces vulnerabilities
in real websites because real websites are secured with maximum sanitisation of the input and maximum
encoding.
Now here we type the image.
Now, applications like Amazon, Flipkart, they also remove the image also because they know that users
are tricked into this.
So there comes your knowledge of utilizing script.
You can encode the entire thing and you are informed and sent via you.
All you can see that is also in the world of what we have sent is also in the.
So you can completely encode the script in your order encoding we had seen in the episode, if you remember,
and then send via you all or you can capture the request, then into the script you can apply a hex
encoding, you can apply binary encoding.
So basically it depends upon how you do it.
It is right now not possible in any of the ethical hacking courses to show each and every step because
the pinging of each and every attacker or a cybersecurity expert should develop on yourself.
This was all for Crosseyed scripting.
I hope you have a clear idea before quitting this, before leaving this lecture, let us shift the security
to impossible and then check the code what they have.
Uncertain.
Let's check the code here.
You can see they have checked the toucan and this is the major trachea, the source code is now checking
the token of the user.
So suppose Sam logs in and his Tolkan is still alive and attacker logs in and tries to exploit and get
the token server will say that, hey, man, your token is different than some.
I can't give you his token.
This is why this attack is prevented in the impossible.
Well, I hope you have an idea of how this works.
From the next lecture, we will see different countermeasures to prevent the attacks and then we will
move on to cross site request forgery.
Again, a humble request.
If you are really liking this cause, please write a review for the schools because it will really motivate
us to bring more courses.
We have more courses in our mind which will really help you to ease your interviews.
So if you are really loving the schools, you just have to write a review and a rating.
That's it.