Cross-Site Request Forgery
Cross-Site Request Forgery is an attack that tricks an authenticated user into unknowingly submitting a malicious request to a web application where they are already logged in. The attacker exploits the trust the application has in the user's browser, causing actions to be performed on the victim's behalf without their knowledge or consent. This typically results in unwanted state-changing operations such as fund transfers, email changes, or account modifications.
CSRF is a web security vulnerability in which an attacker induces an authenticated end user's browser to send a forged HTTP request, including the user's session credentials, to a target web application. Because the application cannot distinguish the forged request from a legitimate one based on session state alone, it executes the requested action under the victim's identity. The attack is effective when the target application relies solely on cookie-based authentication or other credentials automatically included by the browser, and does not implement origin-verification controls such as anti-CSRF tokens, the SameSite cookie attribute, or custom request headers. CSRF exploits the application's trust in the authenticated user rather than the user's trust in the application, making it distinct from cross-site scripting. Successful exploitation requires the victim to be authenticated and to interact with attacker-controlled content, typically via a crafted link or page, during an active session.
Why it matters
CSRF represents a fundamental class of web application vulnerability because it subverts the trust model that underlies authenticated sessions. Web applications typically grant elevated permissions to requests that arrive with valid session credentials. When an attacker can forge such requests, any state-changing operation available to the victim, including fund transfers, password changes, email updates, and administrative actions, may be executed without the victim's awareness. The attack requires no compromise of credentials and leaves minimal forensic evidence, since the malicious request is indistinguishable from a legitimate one at the session layer alone.
Who it's relevant to
Inside CSRF
Common questions
Answers to the questions practitioners most commonly ask about CSRF.