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 provided, they recommend to:
- Abort the request
- Reset the CSRF token
- Log the event as a potential CSRF attack in progress
I did a test, providing a wrong CSRF and get the following results :
- The request is abort and the response's status is set to 403 (= Forbiden)
- The token is not reset
- A simple DEBUG log is done by the Spring CSRFFilter : "Invalid CSRF token found for REQUESTED_URL"
So, my question are:
- Q1: Is it possible to ask Spring Security to reset the CSRF token?
- Q2: Is it possible to ask Spring Security to log a WARN message instead of a DEBUG message about a potential CSRF attack in progress?
Thanks.