What Is Cross Site Scripting (XSS) Attack?
The Cross Site Scripting (XSS) attack is a type of injection and attackers inject your web applications using the client side scripts and malicious code into web pages.
An attacker can insert vulnerability scripts and malicious code in your web applications.
The Cross Site Scripting (XSS) attacks are common on web browsers and it carried out on websites around 84% (approximately).
How
Prevents HTML DOM Based XSS attacks?
<script
type="text/javascript">
let escapeHTML
= function(unsafe_str)
{
return unsafe_str
.replace(/&/g,
'&')
.replace(/</g,
'<')
.replace(/>/g,
'>')
.replace(/\"/g,
'"')
.replace(/\'/g,
''')
.replace(/\//g,
'/')
.replace('src','drc');
}
//Bind HTML - DOM
element.innerHTML
= escapeHTML(iputData);
</script>
I hope you are enjoying with this post! Please share with you friends. Thank you so much!