5

A common way to prevent CSRF is using tokens hidden in forms. Just by curiosity is this the only way of actually preventing CSRF? People arguing about CSRF token not needed is making me crazy and I need to understand why. How can I else prevent CSRF attacks?

1
  • 2
    You should google for CSRF OWASP and read their guidance. CSRF tokens are basically the most effective way to prevent CSRF. Commented Mar 9, 2013 at 19:21

1 Answer 1

1

Actually using a CSRF token is just another layer of defense. According to the OWASP Cross-Site Request Forgery (CSRF) Prevention Cheat Sheet, verifying the request origin can also be used in CSRF protection. To verify the origin we can use,

  1. Origin Header
    • The Origin header includes the information of the scheme,host and port that initiated the request.
  2. Referer Header
    • The Referer header contains the address of the previous web page from which a link to the currently request web page was followed.

However there are limitations in using this approach such as unavailability and integrity of the headers. There are ways for attackers to change the value of these headers. Therefore it is recommended to always have multiple layers of defense.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.