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
1 answer

How can i securely implement CSRF tokens in java

Problem Behind the question : I was trying to prevent csrf attack in my java web application,In order to implement it i have tried with implementation of X-CSRF-Token,whenever the request was made the request would be transmitted through like this…
0
votes
1 answer

_csrf token in 2 forms in the same JSP (CSRF protection)

I want to protect my application from Cross Site Request Forgery (CSRF) attacks, so I added this to my applicationContext.xml:
Nuñito Calzada
  • 4,394
  • 47
  • 174
  • 301
0
votes
2 answers

"Cannot set session ID after the session has started" when generating csrf token within Behat test

I'm trying to test that a user with the wrong permissions sees the correct response when visting a page that has a csrf token in the path. I've added a Behat context step to create a csrf token using the 'security.csrf.token_manager', however then…
TobyG
  • 1,692
  • 3
  • 21
  • 36
0
votes
1 answer

CSRF for internal $_SERVER["REQUEST_METHOD"] form

Trying to implement CSRF token for the first time ever ... I have an internal $_SERVER["REQUEST_METHOD"] form ... Most of the stuff online talks about having it done via _$POST php form ... So ... after reading all that, I've reasoned that since…
user273072545345
  • 1,536
  • 2
  • 27
  • 57
0
votes
1 answer

Is it possible to whitelist a page to not have CSRF applied to it with Spring Security?

Looking at the docs for CSRF security and Spring Security there does not appear to be a way to mark a particular form/url as not needing CSRF protection. I have a site where in general I want CSRF enabled however there is one public page which has…
simbo1905
  • 6,321
  • 5
  • 58
  • 86
0
votes
1 answer

How can I set CSRF in a form in Appcelerator?

I am creating an app that has a login. I want that login to match the username and password but I cannot make it happen because I cannot send the "_token" field, and I cant because I cannot generate the same token that the application will wait…
0
votes
1 answer

Is there a security risk in placing a csrf token as a query parameter in the URL upon submission?

Many of my forms are submitted as multipart/form-data that on my sever are parsed in streams and it is all asynchronous. It would be a pain to wait for the csrf token, receive it and then reject it, meanwhile some of the form has already been…
Alan
  • 1,134
  • 2
  • 13
  • 25
0
votes
1 answer

Prevent user from creating a request from another page

This is technically a csrf attack but this time I am trying to prevent the requests from the user no matter if they are unintentional or not. I have a cloud storage service where a user can perform CRUD operations on files. I would like to exclusive…
Alan
  • 1,134
  • 2
  • 13
  • 25
0
votes
1 answer

CSRF protection in depth

I currently add a CSRF token protection mechanism to my php application. As I read, the only requirement is a unique per-user token, which I generate using random_bytes in php7. My concern is, if the attacker sends a http request using the user's…
W. John
  • 55
  • 1
  • 5
0
votes
2 answers

Expected CSRF token not found. Has your session expired? + Spring security + CSRF

I am trying to implement CSRF via spring security. But, facing following error in browser, after clicking login button(from home.jsp) "Expected CSRF token not found. Has your session expired?" I have following configuration in…
user1755882
  • 11
  • 1
  • 3
0
votes
1 answer

does limiting the host in my mux prevent CSRF attacks?

If I have my mux router limited to accept requests only from my domain, then will that prevent a CSRF attack? For example in my golang server I have all requests go through my baseRouter: baseRouter :=…
Daniel Robinson
  • 13,806
  • 18
  • 64
  • 112
0
votes
2 answers

insert into two tables at once using codeigniter & innodb engine mysql

Hello I have two tables one is users & other is parent mysql query for parent is CREATE TABLE `parent` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `user_id` int(10) unsigned NOT NULL DEFAULT '0', `name` longtext NOT NULL, `dob`…
Cool Perfectionist
  • 205
  • 1
  • 3
  • 18
0
votes
1 answer

Ajax stopped working after enabling csrf_protection

I have changed the config file and set: $config['csrf_protection'] = TRUE; After this the ajax calls have stopped working, when I set to FALSE ajax starts working. I have to enable csrf_protection so how do I make my Ajax start working? Error:…
Ameya
  • 69
  • 2
  • 10
0
votes
1 answer

CSRF Guard on Grails AJAX request

I am having a hard time making CSRF Guard to work on Ajax Requests in my Grails Application. I already added the Javascript Servlet in the page and followed instructions in their website. The problem is that it kept on saying that I have missing…
marvinv
  • 181
  • 2
  • 9
0
votes
1 answer

Converting beforeFilter (4.*) to Middleware (5.*) in Laravel

Recently I've been trying to learn to work with Laravel. Most tutorials are in 4.*, but that's okay. Implementing/converting some deprectated functions are going fine until now. I found out that version 5.* has deprecated the beforeFilter as…
Starfish
  • 3,344
  • 1
  • 19
  • 47