Cross-site request forgery (CSRF) is an attack where a hostile site causes a user's browser to send a request to another site where the user is logged in, so the request carries their cookies and is trusted. Defences include anti-CSRF tokens, SameSite cookie attributes and checking the request origin.
What Cross-Site Request Forgery Looks Like in Practice
CSRF works because the browser supplies ambient credentials automatically. The attacker does not need to steal the victim’s password; they need the victim’s browser to send a state-changing request in a context the target site will accept as authenticated.
That makes the attack especially effective against actions that rely on cookies alone. Any operation that changes account settings, creates sessions, transfers data, or updates preferences can become a target if the server cannot tell a legitimate same-site request from a forged cross-site one.
Why Browser Trust Makes CSRF Dangerous
The core weakness is trust in browser-mediated identity. If the application treats a valid cookie as proof that the request itself is legitimate, a hostile site can trigger the browser to reuse that trust without the user’s intent. This is why CSRF is not about breaking encryption or guessing credentials, but about abusing an existing authenticated session.
The danger rises when requests have side effects and no extra proof of intent. Modern browsers have added defenses such as SameSite cookies and related request metadata, but legacy applications, weak session handling, and unsafe endpoints still leave room for abuse.
How Defences Stop Forged Requests
Effective CSRF defence usually combines server-side validation and browser-side restrictions. Anti-CSRF tokens work by binding each sensitive request to a value the attacker cannot predict or read from another origin, while origin and referer checks help the server confirm the request came from an allowed site.
SameSite cookie attributes reduce when browsers attach cookies cross-site, which removes the automatic credential that CSRF depends on. The strongest implementations use more than one control, because token checks, cookie attributes, and origin validation each fail in different edge cases and should reinforce one another.
For applications that use frameworks, CSRF protection is often partly implicit and partly configuration-driven. That makes review important, because a safe framework can still be weakened by custom routes, exempted handlers, or nonstandard request flows.
Where CSRF Shows Up Most Often
CSRF is most likely on endpoints that change state while accepting simple browser requests, especially when the application uses cookie-based sessions and has not added a second layer of request verification. Login CSRF, preference changes, account linking, and destructive actions are common examples because they can be triggered with minimal user interaction.
The risk is broader than traditional web forms. Browser-exposed APIs, mixed legacy and modern routes, and flows that rely on automatic cookie submission can all inherit the same weakness if they do not distinguish a legitimate user action from a cross-site one.
Risk and Threat Considerations
CSRF is dangerous because it turns a logged-in browser into a trusted proxy for an attacker’s request. The result can be unauthorized state change, account manipulation, or unwanted transactions without the attacker ever learning the victim’s credentials.
Failure mechanism: The application accepts a request as legitimate solely because the browser attached valid session cookies, while failing to require proof that the request originated from the site itself or from a user-intended action.
Impact: Attackers can trigger sensitive actions in the victim’s account, alter settings, perform transactions, or chain the forged request into broader compromise when the application lacks transaction-level verification.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP ASVS, NIST SP 800-53 Rev 5 and CIS Controls v8 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP ASVS | V8 — Authorization | CSRF protection enforces that requests are authorised by the app, not just authenticated by cookies. |
| V10 — OAuth and OIDC | CSRF also affects browser-based login and redirect flows that rely on state validation. | |
| Recommendation — Require anti-CSRF checks on every state-changing request and verify same-site or same-origin intent. Validate state and redirect handling in browser auth flows to prevent forged cross-site actions. | ||
| NIST SP 800-53 Rev 5 | IA-2 — Identification and Authentication (Organizational Users) | CSRF exploits authenticated user sessions, so request integrity depends on strong user authentication context. |
| AC-10 — Concurrent Session Control | Session-backed web actions are the trust basis CSRF abuses, making session control and validation material. | |
| Recommendation — Use strong user authentication and pair it with request-level anti-forgery controls. Limit and monitor session use so authenticated browser sessions cannot be silently abused. | ||
| CIS Controls v8 | CIS-6 — Access Control Management | CSRF is an access-control failure at the application request boundary. |
| Recommendation — Enforce application-side request validation and remove unsafe endpoints from default trust. | ||
Practitioner Guidance
What to watch for: Treat any cookie-authenticated endpoint that changes state as CSRF-exposed until proven otherwise. The most common gap is an endpoint that has authentication but no request-specific anti-forgery check, especially when developers assume SameSite alone is enough.
Governance implication: CSRF protection should be reviewed as part of application security standards, not as an optional per-feature fix. Teams should test form handlers, API routes, and framework exemptions consistently so that one unsafe endpoint does not bypass the rest of the protection model.
Related resources from NHI Mgmt Group
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on November 24, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org