Cross-Site Request Forgery (CSRF)

OWASP Top 10 2013 - A8


OWASP just updated the Top 10 list.
Check out this in-depth post to learn everything about the new OWASP Top 10 2021.

Discover OWASP Top 10 2021

What is Cross-Site Request Forgery (CSRF)?

Cross-Site Request Forgery (CSRF) is an attack that forces an end user to execute unwanted actions on a web application in which they're currently authenticated. CSRF attacks specifically target state-changing requests, not theft of data, since the attacker has no way to see the response to the forged request. With a little help of social engineering (such as sending a link via email or chat), an attacker may trick the users of a web application into executing actions of the attacker's choosing. If the victim is a normal user, a successful CSRF attack can force the user to perform state changing requests like transferring funds, changing their email address, and so forth. If the victim is an administrative account, CSRF can compromise the entire web application.

Example of a Cross-Site Request Forgery attack

In order for perform a Cross-Site Request Forgery attack, the victim must be authenticated with the target website. The attacker includes a script in a third-party website that the victim visits. When the victim visits that website, the script will be executed without the victim noticing. For example, in a car forum, an attacker posts a message which contains a script which performs transfers in the victim's bank (target website).

        <div style="display:none;">
        <iframe id="frame" name="frame"></iframe>

        <form target="frame" id="formid" action="" method="post">
          <input type="hidden"
          <input type="hidden"
           <input type="hidden"
          <input type="hidden"
              value="EVIL ACCOUNT"/>
          <input type="submit"


Even if HTTP POST is disabled, the same attack could be performed with HTTP GET request.

<img src="">


Test Drive The Unified Security Platform

Get Started


Learn the answers to the key questions regarding IAST tools

Download Now

How to Prevent Cross-Site Request Forgery (CSRF)

Add a per-request nonce to the URL and all forms in addition to the standard session. This is also referred to as "form keys".

Risk Covered by Hdiv Protection (RASP)

  • Hdiv automatically adds a random token to all URLs and forms.
  • Hdiv offers an extreme security level adding a new random token per request. Many frameworks have or are starting to include this type of protection "built-in" to every form but this protection level is not enough. Applications developed with these frameworks remain vulnerable because the random token generated by them is per session and not per request as with Hdiv.
Since 2008 in productionSINCE 2008IN PRODUCTION
more than 128 countriesMORE THAN 128COUNTRIES
Fortune 500 companiesFORTUNE 500COMPANIES


The 7 Key Factors to Successful DevSecOps

Download Now



The 7 Key Factors to Successful DevSecOps

Download Now


Hdiv Detection (IAST) for Developers



The Best Protection Against OWASP Top 10 Risks



Agile protection: above and beyond the WAF

Read More