ValidateAntiForgeryToken is the ASP.NET Core protection pattern that checks whether a request includes a valid anti-forgery token before executing a state-changing action. It is used to block forged browser requests that would otherwise ride on an authenticated session and appear legitimate to the server.
What ValidateAntiForgeryToken Does
ValidateAntiForgeryToken is a request-validation control that confirms a submitted anti-forgery token is present and valid before a state-changing action runs. In ASP.NET Core, that check helps the server distinguish a deliberate browser action from a forged request that may still carry a valid session cookie.
The practical point is that the protection is tied to the request being executed, not just to the user being signed in. That matters because modern web applications often trust authenticated browser sessions by default, and anti-forgery validation adds a second proof that the request originated from the application’s own flow rather than from an external site.
Why Anti-Forgery Validation Exists
Browser-based attacks can exploit ambient authentication. If a victim is already signed in, a malicious page, image, form submission, or cross-site request can sometimes trigger an action in the target application without the user’s intent. Anti-forgery validation exists to stop that class of request from being treated as legitimate.
The control is most important for actions that change state, such as creating records, updating settings, changing passwords, or approving transactions. Read-only requests are usually less exposed, but any endpoint that relies on the browser automatically presenting credentials can become a target if it accepts unsafe cross-origin state changes.
How the Token Check Works
Anti-forgery systems typically use a token pair or equivalent hidden value plus server-side validation to bind a form submission or request to the application that issued it. In ASP.NET Core, ValidateAntiForgeryToken performs that server-side verification before the action executes, so the request must carry the expected anti-forgery evidence in the expected context.
This is not the same as authentication. Authentication establishes who is signed in; anti-forgery validation checks whether the request itself is trustworthy enough to execute a sensitive action. The two controls complement each other, but they solve different problems.
When It Is Typically Applied
Developers usually apply the attribute to actions that accept browser-submitted form data and cause side effects. It is especially relevant in MVC-style applications where the server renders forms and expects the client to return them, because that pattern is easy to protect with a synchronised token.
- Use it on state-changing POST, PUT, PATCH, and DELETE handlers that come from a browser workflow.
- Pair it with form-generation helpers or framework features that emit the matching token into the request.
- Keep it aligned with the application’s request patterns, especially when APIs, SPA flows, or AJAX requests use different submission methods.
Risk and Threat Considerations
Without anti-forgery validation, a signed-in browser session can be abused by a cross-site request that looks legitimate to the server. The danger is not just unauthorized clicks, but silent state changes, privilege-sensitive actions, and workflow abuse that occur while the victim remains authenticated.
Failure mechanism: An attacker induces the victim’s browser to send an authenticated request to a sensitive endpoint, and the server accepts it because no valid anti-forgery token is required or checked.
Impact: The application may process unintended state changes, account updates, approvals, or other actions under the victim’s session, creating integrity loss and potentially enabling follow-on compromise.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP ASVS and NIST SP 800-53 Rev 5 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP ASVS | V8 — Authorization | Anti-forgery checks protect state-changing requests from unauthorized execution. |
| V16 — Security Logging and Error Handling | Rejected anti-forgery attempts should be observable for abuse detection. | |
| Recommendation — Require anti-forgery checks on browser-driven state-changing actions to reduce request forgery risk. Log failed anti-forgery validation events so suspicious request forgery can be investigated. | ||
| NIST SP 800-53 Rev 5 | AC-10 — Concurrent Session Control | Session-bound browser requests can be abused without request validation. |
| SC-23 — Session Authenticity | Anti-forgery tokens help verify request provenance within an established session. | |
| Recommendation — Validate browser-originated state changes so authenticated sessions cannot be abused by forged requests. Use session authenticity checks to ensure sensitive requests are genuine before processing them. | ||
Practitioner Guidance
What to watch for: Apply the control wherever a browser session can drive a sensitive state change, and be careful not to assume that authentication alone makes the endpoint safe. If an action changes data or privilege state, it usually deserves explicit anti-forgery protection unless the endpoint is designed around a different trust model.
Practitioner takeaway: Anti-forgery validation is a request-integrity control, not a login control, and it is most effective when it is consistently applied to every browser-facing state-changing path.
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 October 31, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org