Questions tagged [csrf-protection]

Cross-site request forgery, also known as a one-click attack or session riding and abbreviated as CSRF (sometimes pronounced sea-surf) or XSRF, is a type of malicious exploit of a website whereby unauthorized commands are transmitted from a user that the website trusts. Unlike cross-site scripting (XSS), which exploits the trust a user has for a particular site, CSRF exploits the trust that a site has in a user's browser.

Cross-site request forgery, also known as a one-click attack or session riding and abbreviated as CSRF (sometimes pronounced sea-surf) or XSRF, is a type of malicious exploit of a website whereby unauthorized commands are transmitted from a user that the website trusts. Unlike cross-site scripting (XSS), which exploits the trust a user has for a particular site, CSRF exploits the trust that a site has in a user's browser.

Web sites have various CSRF countermeasures available:

  • Requiring a secret, user-specific token in all form submissions and side-effect URLs prevents CSRF; the attacker's site cannot put the right token in its submissions. This technique is commonly referred to as the Synchronizer Token Pattern.
  • Requiring the client to provide authentication data in the same HTTP Request used to perform any operation with security implications (money transfer, etc.)
  • Limiting the lifetime of session cookies
  • Ensuring that there is no clientaccesspolicy.xml file granting unintended access to Silverlight controls
  • Ensuring that there is no crossdomain.xml file granting unintended access to Flash movies
  • Verifying that the request's header contains a X-Requested-With (used by Ruby on Rails before v2.0 and Django before v1.2.5), or checking the HTTP Referer header and/or HTTP Origin header. These protections have been proven insecure under a combination of browser plugins and redirects which can allow an attacker to provide custom HTTP headers on a request to any website, hence allowing a forged request.

Links:

712 questions
4
votes
2 answers

ColdFusion CSRF XSS attack prevention

I have implemented the csrfGenerateToken and csrfVerifyToken functions in trying the prevent a CSRF attack. I have set up the webpage header with these: set X-XSS-Protection "1; mode=block" always set X-Frame-Options…
Jack
  • 853
  • 1
  • 7
  • 20
4
votes
1 answer

CSRF protection in singlepage web application

My Application structure as follows 1)API server running in api.mydomain.com 2)Frontend VUejs application running in www.mydomain.com So i implemented authentication via httponly cookie. But little confused with CSRF token…
shamon shamsudeen
  • 5,466
  • 17
  • 64
  • 129
4
votes
3 answers

Remove csrf token only for single method - Laravel

I am using paytabs payment gateway api. In that api, a redirect url have to given, so that once the transaction is completed, the page will redirect automatically to your given redirect url. The url was a GET url but since the response of the api…
nerdyDev
  • 376
  • 3
  • 15
4
votes
1 answer

How to write accessDeniedHandler in grails

I am new to groovy, I have implemented CSRF Token in grails in following manner. CSRF filter is added in resource.groovy csrfFilter(CsrfFilter, new HttpSessionCsrfTokenRepository()) { accessDeniedHandler = ref('fnAccessDeniedHandler') …
ap.singh
  • 1,150
  • 4
  • 15
  • 35
4
votes
2 answers

How to pass codeigniter's CSRF token to Paypal Express Checkout?

I am integrating Paypal Express Checkout with server-side REST into my codeigniter website. As per Paypal doc's i added the following to my checkout page: