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
4 answers

Symfony2.1: The CSRF token is invalid. Only in browser, PHPUnit WebTestCase works without error

How can I debug why in all my browsers I got The CSRF token is invalid error, but when I test same form with Functional test it works?
Paweł Madej
  • 1,229
  • 23
  • 42
0
votes
1 answer

codeigniter csrf protection error with ajax

i have a small problem here which i cannot fix,This post goes through but the response returns a “500 internal server error” who to fix it? after search in CI forum i found this this link codeigniter-csrf-protection-with-ajax but i cant solve by…
Hamed Yarandi
  • 1,085
  • 1
  • 12
  • 21
0
votes
1 answer

How to prevent http requests forgery if the content is private? (basically allow only requests from my interface , not browser)

Sorry for asking this again but ppl seem to connect csrf only with form submissions or form duplication (idk why). My ideea would be to secure the data from outside requests . Set a token for each request , and start the tokenising since the user…
Cata Cata
  • 166
  • 1
  • 9
-1
votes
2 answers

SwfUpload give 302 error when upload images

I am using swfUpload plugin with paperclip which use flash to upload images but when i press upload button it give me this error and image are not upload and not save in DB.It show this error. alexa's-lace-waist-yoga-pants-size4.jpg …
-1
votes
1 answer

CSRF attack in angular7

How to prevent CSRF attack in angular7 when I use XMLHttpRequest let xhr = new XMLHttpRequest(); var inputData = {}; xhr.open('POST', this.hostUrlConstants["baseUrl"] + this.pathUrlConstants["xxxx"] + this.pathUrlConstants["yyy"] + "/" +…
Lakshmi
  • 85
  • 12
-1
votes
1 answer

Is it neccessary to renew CSRF token in JWT token for every request/response?

I'm developing a web application using symfony and JWT token for authentication. For preventing XSS, JWT token is stored in cookies with HttpOnly attribute. And for preventing CSRF, I used random csrf token. This token are stored in cookie and JWT…
dewi suci
  • 19
  • 6
-1
votes
1 answer

Django causing 403 forbidden error when i add csrf middleware

When I add CSRF middleware django.middleware.csrf.CsrfViewMiddleware to prevent xss csrf attack I am getting error response 403 csrf error. I referred to the official doc and old Stack Overflow answers but still I didn't get any idea why it…
skysoft999
  • 540
  • 1
  • 6
  • 27
-1
votes
1 answer

Regarding Cross site Scripting Forgery

I am working on csrf and using spring 5. Spring 5 automatically provide supports for csrf and on enabling csrf protection on the server side I am getting 403: Invalid X-CSRF token So this means a token needs to come from frontend? My understanding…
zaib7777
  • 89
  • 3
  • 14
-1
votes
1 answer

Spring MVC - Add custom CSRF Header to all HTTP responses

In my Spring MVC application, I want to implement a sort of CSRF header on annotated controllers methods. I already have 100% working client's CSRF header parser implemented on the HandlerInterceptorAdapter.preHandle method and I used to try, in the…
Andrea Grimandi
  • 631
  • 2
  • 8
  • 32
-1
votes
1 answer

Laravel sessions broken after ubuntu update

I've upgraded my ubuntu server to version 18.04.1. After the upgrade my laravel website keeps displaying TokenMismatchException in every single POST page. The only exception to this rule seems to be the login page, which works for some users and not…
-1
votes
1 answer

How does CSRF get access to information of some website to exploit security?

I have been trying to learn about CSRF attacks. I know that it is uses the credentials from a session of a valid site and use that session information from another site to make requests to the valid site. I want to know how anyone can access the…
pramesh
  • 1,914
  • 1
  • 19
  • 30
-1
votes
1 answer

Is CSRF protection really required in REST?

Is CSRF protection really expected to be present in a REST based application? I know it is required for web applications where JSPs are served from the server end. But I am developing a Spring Boot enabled REST service that will be consumed by…
Abhishek Chatterjee
  • 1,962
  • 2
  • 23
  • 31
-1
votes
1 answer

How to avoid Cross Site Cross-Site Request Forgery for GET Request

How to avoid Cross-Site Request Forgery for GET method. I have used AntiForgeryToken for all POST methods in my MVC application. Even though it is not needed for Get request, but I want to know the solution to prevent CSRF for HttpGet methods.
UnKnownSol
  • 11
  • 5
-1
votes
1 answer

CSRF prevention on Web App

I am creating a web app and im trying to secure the application. I have done a vulnerability scan and found XSS on my login page. I cannot figure how to secure the application from XSS. Can someone please help. I have stop sql injection for the…
-1
votes
2 answers

Implementation of CSRF Tokens per Session Information

I have been reading up on how CSRF Tokens are implemented to prevent CSRF attacks. The OWASP page (https://www.owasp.org/index.php/Cross-Site_Request_Forgery_(CSRF)_Prevention_Cheat_Sheet) and various articles state that one can generate a random…
Kevin
  • 635
  • 3
  • 9
  • 18
1 2 3
47
48