If you see a CSRF token value set in a cookie without httponly set on it, what else would you be checking to see if the application has proper CSRF protection?
TechnicalSecurity TesterWeb Application TesterPenetration TesterIf I see a CSRF token value set in a cookie without HttpOnly set, I would check for several key aspects to ensure proper CSRF protection. First, I would verify if the application uses a same-site cookie attribute. This attribute helps mitigate CSRF attacks by restricting how cookies are sent with cross-origin requests. If the attribute is set to 'Strict' or 'Lax', it significantly reduces the risk of CSRF.
Next, I would examine the implementation of the CSRF token itself. It should be unique per session and included in both the request header and the request body for state-changing operations. This dual inclusion helps ensure that the token is validated correctly on the server side. Additionally, I would check if the application uses anti-CSRF libraries or frameworks that provide built-in protection mechanisms.
For example, if I find that the application uses a CSRF token sent in the request header but does not validate it against the session, it would indicate a potential vulnerability. The trade-off here is between usability and security; while using cookies simplifies state management, it can expose the application to CSRF risks if not implemented correctly.