Cross-Site Request Forgery attacks and vulnerability
A Cross-Site Request Forgery (CSRF) attack consists of sending illegitimate requests to a site on behalf of a user who is already authenticated via a session cookie. These illegitimate requests are usually triggered by the authenticated user visiting a malicious website, which sends the forged requests to the target site (typically using Javascript in a web browser). Without CSRF protection, the session cookie and the requests originating from the malicious site are indistinguishable from legitimate requests by the server.
Note that the same-origin policy implemented in web browsers ensures that responses to requests originating from the malicious site cannot be accessed by the malicious script.
- Read-only operations like
GET
requests are considered to be safe request methods and therefore not subject to CSRF attacks. - When CSRF protection is enabled, the CSRF token is automatically disabled for sessions that do not use the Security Gate session cookie. So, for example, for mobile applications that cannot use the Security Gate session cookie, but instead use the configured request header for session tracking. Note that this implicit disabling is not visible in the log files.
- Your application is vulnerable to Cross-Site Request Forgery attacks if all the following points are true:
- The user's web browser can automatically send the session credentials. This includes but is not limited to the case where session tracking is done via cookies. Credentials from other authentication schemes, such as Basic or client certificate authentication, can also be automatically sent by the browser.
- There are state-changing requests requiring an authenticated session.
- The URLs of those state-changing requests are not secret. This is usually always the case excepted when session-based URL encryption is enabled.
We highly recommend enabling the Security Gate CSRF token if your application is vulnerable to CSRF attacks.