Join our Newsletter — 33% off our NHI Course

Why do Spring applications remain vulnerable to CSRF when developers use POST instead of GET?

POST changes the transport, but it does not prove the request was user initiated. An attacker can still embed a malicious HTML form that submits a forged POST on behalf of a trusted browser session. Without origin verification or a CSRF token, the application may accept the request because it looks structurally valid, even though the intent came from an attacker.

Why POST does not stop CSRF in Spring

CSRF is about trust in the browser, not the HTTP verb. A browser will automatically send cookies, session IDs, and other ambient credentials with a cross-site POST if the user is already authenticated, so the server may see a perfectly valid request even though the attacker initiated it. That is why POST alone does not prove intent or origin.

The weakness is structural: HTML forms can submit POST requests cross-site without needing script access to the target application. If Spring application code accepts state-changing POSTs without a separate anti-CSRF check, the request can be accepted as legitimate because it matches the expected method and session context. Method choice changes routing, not provenance.

For teams hardening web applications, the right mental model is that POST is a transport detail, while CSRF protection is a trust decision. The control must verify that the request was initiated by the same site or carries a token that a third party cannot guess or replay. Otherwise, any action protected only by “it is a POST” remains forgeable.

What Spring expects for request provenance

Spring’s CSRF defense is designed around per-session or per-request proof, not around the verb itself. In practice, that means the application needs a token check, origin-aware validation, or another explicit mechanism that binds the action to the legitimate browser context. If the application relies on a default browser submission pattern alone, it is treating ambient credentials as sufficient proof.

That distinction matters most for state-changing operations such as profile updates, password changes, payment actions, and privileged administrative actions. Those requests often look normal at the transport layer, which is exactly why CSRF exists. A forged POST can carry the right cookies, the right endpoint, and the right payload shape while still being attacker-driven.

When reviewing a Spring application, verify whether CSRF protection is enabled for the relevant endpoints and whether the client actually sends and validates the token correctly. Also check whether any endpoints were exempted for convenience during development, because partial exemptions often become the real attack surface once the application reaches production.

Spring’s default posture is described well in the OWASP Cheat Sheet Series, which is useful here because it reinforces the core point: anti-CSRF controls must prove request origin or intent, not just accept a valid-looking form submission. For a practical attacker path, the browser behavior is the problem, and the control has to be layered above it.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP Agentic AI Top 10 address the attack and risk surface, while NIST CSF 2.0 and CIS Controls v8 set the governance and control requirements practitioners need to meet.

Framework Control / Reference Relevance
OWASP Agentic AI Top 10 A1 — Agentic Access Control Forged browser requests abuse authorization assumptions around action initiation.
Recommendation — Enforce explicit request provenance checks before accepting state-changing actions.
NIST CSF 2.0 PR.AC-1 — Identity and Access Management Policy Enforcement CSRF is a trust and access-control failure around authenticated browser sessions.
Recommendation — Require anti-CSRF controls wherever authenticated sessions can change state.
CIS Controls v8 6 — Access Control Management State-changing requests need controls that verify access intent, not just session presence.
Recommendation — Restrict and validate authenticated actions with token-based request checks.

Practitioner Guidance

What to verify: Confirm that every state-changing Spring endpoint either enforces CSRF tokens or has a deliberate, documented exception with compensating controls. Do not assume “non-GET” is enough, especially for endpoints that can be reached from a browser session.

Common mistake: Teams often disable CSRF protection while building APIs, then later expose browser-accessible routes through the same application. If a browser can send authenticated requests to the route, CSRF remains in play even when the route uses POST.

Decision rule: If an endpoint changes server state and accepts cookie-based authentication, treat it as CSRF-relevant unless you have a stronger request-origin control in place. If the endpoint is truly non-browser machine-to-machine traffic, handle that as a different trust model rather than relying on POST as a substitute for validation.

Practitioner takeaway: The real control boundary is not GET versus POST, it is whether the server can distinguish a legitimate user action from a forged browser-submitted request.