OWASP CSRFGuard 3.1.0
We are working on a new version of CSRFGuard including a lot of merge request with good proposals and new code to fix known issues on XSS attacks that bypass CSRFGuard.
BSD License, All rights reserved.
Welcome to the home of the OWASP CSRFGuard Project! OWASP CSRFGuard is a library that implements a variant of the synchronizer token pattern to mitigate the risk of Cross-Site Request Forgery (CSRF) attacks. The OWASP CSRFGuard library is integrated through the use of a JavaEE Filter and exposes various automated and manual ways to integrate per-session or pseudo-per-request tokens into HTML. When a user interacts with this HTML, CSRF prevention tokens (i.e. cryptographically random synchronizer tokens) are submitted with the corresponding HTTP request. It is the responsibility of OWASP CSRFGuard to ensure the token is present and is valid for the current HTTP request. Any attempt to submit a request to a protected resource without the correct corresponding token is viewed as a CSRF attack in progress and is discarded. Prior to discarding the request, CSRFGuard can be configured to take one or more actions such as logging aspects of the request and redirecting the user to a landing page. The latest release enhances this strategy to support the optional verification of HTTP requests submitted using Ajax as well as the optional verification of referrer headers.
The CSRFGuard project is run by Azzeddine RAMRAMI. He can be contacted at azzeddine.ramrami AT owasp.org.
OWASP CSRFGuard 3.1.0 is offered under the BSD license
OWASP CSRFGuard 3.1.0 will be available on Maven Central. Add the following dependency to your Maven POM file to use the library:
org.owasp csrfguard 3.1.0
mvn clean installin the project root directory
mvn pre-integration-test -Pdeploy-jsp-webapp -pl csrfguard-test/csrfguard-test-jspor
mvn -Pdeploy-jsp-webapp -pl csrfguard-test/csrfguard-test-jsp tomcat7:run
mvnDebugto enable remote debugging, then connect your IDE to it (default port is 8000)
http://localhost:8080to open the home page of the test project
You can sign up for the OWASP CSRFGuard email list here.
An important security fix has been applied to the CSRFGuard version 3.0.
Do a token pre-fetch on every page.
Instead of hard coding the CSRF token, we send a POST request to fetch the token and populate the JS variable.
Thanks to Ahamed Nafeez [email protected] for this fix.
You can download a binary version from Maven Central here:
Thanks to Trent Schmidt and Joel Orlina (JIRA) for there help.
Yi SONG create for CSRFGuard project a simple example to demostrate the CSRFGuard integration with a JSF application.
The original JSF project is taken from https://mkyong.com/jsf2/jsf-2-0-hello-world-example/
After integrating with csrfguard, the project has been tested on netbean 8.2 with glassfish 4.1.1
Yi SONG received my master of engineering in China in 2006. Then I start work for Axalto, then Gemalto and then Thales till now. He has 3 years experience on smartcard development, 10 years experience on cryptography and hardware security module. Since end of 2018, his work is focusing on web application and cloud.