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
0
votes
2 answers

GWT & CSRF Guard - Is it possible to implement CSRF Guard on GWT code?

I have web application in which front end is written in GWT. Now I want to implement CSRF Guard on the same web application. So I would like to know that is it possible to implement CSRF Guard on GWT code because when I tried implementing it CSRF…
SK.
  • 4,174
  • 4
  • 30
  • 48
0
votes
2 answers

CSRF Guard - how to validate generated token at server side

I'm very new to web security and I'm trying to implement CSRF Gaurd on my web application. I have done all the required configuration on my web application and I can see that token (FWJY-N767-M4HG-DHXT-WCE4-5J08-MV4G-LNV4) is getting…
SK.
  • 4,174
  • 4
  • 30
  • 48
0
votes
1 answer

how to set csrf token for allowed list of websites

I am having two servers says domain name "example.com" and "demo.com". I did all my project stuff in "demo.com". But I want sign up page of "demo.com" also in "example.com" home page where user is redirected after POST data to "demo.com" server…
Gaurav Nagpal
  • 155
  • 2
  • 15
0
votes
1 answer

Should I be using a CSRF if I'm planning on implementing a multi-app API?

I'm in the process of creating a Laravel API/AngularJS Monster. The idea of completely separating them out (Frontend, DB, API) was mainly because I wanted to get into app development and keep all things separate so the API could do all the grunt…
user393219
0
votes
1 answer

HDIV - AJAX configuration

This is the continuation of this question HDIV - Multipart not configured - Struts 1.3 1 I made many changes in my pages to make it work for HDIV. But I could not fix the ajax calls. How to configure the HDIV for ajax requests? The ajax calls in…
vvra
  • 2,832
  • 5
  • 38
  • 82
0
votes
1 answer

HDIV - Multipart not configured - Struts 1.3

I am using HDIV to protect my web application from the csrf attacks. My application was long developed in Struts-1.3.10. The hyper links and normal pages works well, but except the multipart file upload pages. I get multipartconfig not present…
vvra
  • 2,832
  • 5
  • 38
  • 82
0
votes
2 answers

Authorize POST requests from one app to other

I have two web applications which need to communicate data between them, for example when an employee is added in Application A, i make a CURL request / POST request ** and pass some of the employee data and Store it in **Application B. The…
opensource-developer
  • 2,826
  • 4
  • 38
  • 88
0
votes
1 answer

Cannot skip CSRF security for controller

I want to disable CSRF security for one controller. My ApplicationController looks like this: class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. protect_from_forgery with: :exception And…
Adrian Deja
  • 737
  • 1
  • 9
  • 17
0
votes
1 answer

Spring Security - CSRF - How to reset CSRF token and log a potential CSRF attack (OWASP recommendation)

We are using Spring Security framework in our application, especially to prevent it against CSRF attacks. In the OWASP document about CSRF attacks prevention cheat sheet, they talk about the Synchronizer Token Pattern. So, when a wrong CSRF token is…
0
votes
1 answer

Spring Security | CSRF metatags not working for internet explorer

I am using spring security 3.2.2 version in my application. To protect csrf attack in my application I have used spring security csrf meta tags. Here below is my code: Security.xml In security xml I have added below tag. There are two jsps.…
Sanjay Jain
  • 3,518
  • 8
  • 59
  • 93
0
votes
1 answer

CSRF token, for data retrieving request

I want to add CSRF protection to my web service. and I learned I should add a token to the request. Problem is adding tokens to GET requests are very disclosive. HTTP protocol says GET requests should be used only for retrieving. But, this doesn't…
pandora2000
  • 463
  • 1
  • 4
  • 12
0
votes
1 answer

csrf_token not created on pages loaded via post

I have an issue with the {% csrf_token %} template tag in Django. On pages loaded via get it is fine but if I use post to load a page the tag is not loaded to forms on the page requested with post. I am using render_to_response to render the…
icebox3d
  • 449
  • 7
  • 17
0
votes
2 answers

Send CSRF token inside javascript POST gives an Error

In my web application I'm using spring security 3.2.x and I'm doing CSRF validation. In my login page I have successfully done this. But inside, I have a button and the button action is written inside a javascript …
Ravindu
  • 2,408
  • 8
  • 30
  • 46
0
votes
3 answers

Avoiding CSRF tokens

I have a scenario where I already have CSRF tokens, but I have to remove. On an ecommerce, the product page is cached by Varnish, so if the user lands directly here, he won't have a session ID to validate the token. In this page I have a "add to…
Rafael Kassner
  • 1,123
  • 6
  • 21
0
votes
2 answers

CSRF token not working in nodejs express

I am developing a simple web app using nodejs, express and when i switched to session and csrf, my PUT, DELETE and POST Requests are failing. with error: error: Forbidden at Object.exports.error…
Ashish Negi
  • 5,193
  • 8
  • 51
  • 95