OWASP CSRFGuard 3.0
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.
This projet is now run by Azzeddine RAMRAMI. He can be reached at azzeddine.ramrami at owasp.org.
OWASP CSRFGuard 3.0 is offered under the BSD license
Using with Maven
OWASP CSRFGuard 3.0 is available on Maven Central. Add the following dependency to your Maven POM file to use the library:
<dependency> <groupId>org.owasp</groupId> <artifactId>csrfguard</artifactId> <version>3.0.0</version> </dependency>
Building the code
- Make sure that you have Apache Maven 3.0.4 or higher installed;
- Clone this repository locally;
- Build the
csrfguardproject first as
cd csrfguardfollowed by
mvn clean install;
- Build and run the
cd ../csrfguard-testfollowed by
mvn clean package tomcat7:run;
- Use a web browser to access
http://localhostto open the home page of the test project.
Uploading to the Maven Central repository
- Follow the Sonatype Open-Source Project Maven Repository Usage Guide to create a Sonatype user account;
- Next, open a support request to get your newly created username added to the Maven groupId
- Once the support request has been completed, follow the instructions in the Sonatype Maven repository usage guide mentioned above to upload new versions to the Maven Central repository.
You can sign up for the OWASP CSRFGuard email list here.