The scanner says the form has no CSRF token. Can another site actually submit it? Cross-site request forgery as a DAST finding: SameSite defaults, token absence versus token enforcement, JSON bodies and preflight, login CSRF, and how the finding gets confirmed

DedSec Security Research ·

Here is a hypothetical. A dynamic scan of a web application returns four results about cross-site request forgery. The first, "Absence of anti-CSRF token", rated medium, is on the change-email form at /account/email: the form has no hidden field that looks like a token. The second, on the change-password form at /account/password, never appears, because that form carries a hidden csrf field and the check considers it protected. The third is on /api/transfer, a JSON endpoint, and the scanner's own note says CSRF does not apply to JSON bodies, so it is closed. The fourth is the login form, flagged for having no token, rated informational, and closed because "the user is not logged in yet, and the session cookie is SameSite=Lax anyway".

As in the earlier posts in this series, each decision rests on the title rather than on what the scanner observed and what that observation can prove. The change-email page submits through JavaScript that sends the token in a request header, and the server rejects any request without it. The form has no field because it does not need one, and the medium is a false positive. The change-password handler checks the token only when the field is present, so a forged form that simply leaves it out goes through. The transfer endpoint parses the body as JSON whatever the Content-Type says, so an ordinary HTML form posting text/plain can send it a JSON document. And in our lab a cross-site login form logged the victim's browser into the attacker's account under every SameSite value we tried, Strict included, because SameSite controls which cookies are sent, and a login request needs none.

This post is for whoever is holding a CSRF finding from a dynamic scan, or a clean result they are about to rely on. It covers:

It is the seventeenth post in a series about confirming DAST findings. The earlier ones cover reflected XSS, SQL injection, OS command injection, Nuclei template matches, ffuf content discovery, path traversal, open redirect, SSRF through URL-fetch parameters, XXE, CRLF header injection, Host header injection, HTTP request smuggling, CORS misconfiguration, JWT validation, Arjun parameter discovery and server-side template injection. The nearest neighbour is the CORS post. CORS governs whether a cross-origin page can read a response, while CSRF is about whether it can cause a request, and that post measured the same SameSite behaviour from the reading side. The JWT post is the other neighbour, because a bearer token the application attaches itself is not something a browser sends on an attacker's behalf.

Sources, and how each was checked. We made the measurements below on our test machine on 6 November 2026. It runs Ubuntu 24.04.4 on a virtual machine with two vCPUs of an AMD EPYC 9354P. Every server and the browser ran as a non-root user inside a Linux network namespace whose only interface was loopback. Before each run we checked the isolation: the name example.com did not resolve and a TCP connection to 1.1.1.1 failed. The software was:

We read the Chromium project's "SameSite Updates" page and its "SameSite FAQ", web.dev's article "Understanding 'same-site' and 'same-origin'", the OWASP Cross-Site Request Forgery Prevention Cheat Sheet as published in the OWASP CheatSheetSeries repository that day, and MDN's Set-Cookie reference from the mdn/content repository, all on 6 November 2026. Every quotation and claim attributed to them below was checked against those copies.

We did not test Firefox, Safari or any other browser, a Chrome profile with third-party cookies restricted, or any browser older than the one named. We did not test any framework's CSRF middleware, any DAST tool's CSRF check, or any Nuclei template other than the one named. We did not test plain-http origins, which the CORS post covers, multipart forms, method-override parameters, cross-site WebSocket hijacking, clickjacking, or CSRF triggered by the application's own JavaScript. The opening scenario is hypothetical. The numbers measure our lab, one browser build and one template, and none of them measures AppSecD or how any product checks for CSRF.

What CSRF needs, in mechanism

A browser attaches some credentials to a request on its own: cookies, HTTP authentication it has cached, a client certificate. It does this whichever page started the request. Cross-site request forgery is a page on another site using that to make the victim's browser send a request the victim did not intend, with the victim's credentials attached. CWE-352 is the usual classification.

The OWASP cheat sheet puts the consequence plainly: "unprotected target sites cannot distinguish between legitimate authorized requests and forged authenticated requests." The attacker never sees the response. The request is the attack.

So an exploitable CSRF is a conjunction of four things:

  1. The action is authorised by something the browser attaches automatically. A session cookie, typically. An Authorization: Bearer header that the application's own JavaScript adds is not attached by the browser to a request another page makes, which is why an API authenticated only that way is not a CSRF target. The JWT post covers where such tokens live.
  2. The attacker can construct the whole request. Nothing in it is a secret the attacker cannot know or guess: no session-bound token, no custom header that a cross-site page cannot set without a preflight.
  3. The browser will send it, with the credential. That depends on the cookie's SameSite attribute, the browser's default for cookies without one, the kind of request (top-level navigation, iframe, image, fetch), its method, and whether the attacking page is cross-site or merely cross-origin.
  4. The action matters. Changing an email address or a password, moving money, adding an administrator, or logging the victim in as someone else.

A finding that says "no token in the form" speaks to point 2 at most, and only to one way of meeting it.

Cross-site is not cross-origin

An origin is scheme, host and port. A site is coarser. web.dev's definition is that websites "that have the same scheme and the same eTLD+1 are considered" same-site. The eTLD+1 is the registrable domain, worked out with the Public Suffix List, and the same article's table marks different ports as "Same-site: ports don't matter". So https://blog.bank.test:8443 and https://app.bank.test:8443 are different origins and the same site. SameSite cookies are about sites. A page on any subdomain of your registrable domain is, for SameSite purposes, you.

Browsers report the relationship in the Sec-Fetch-Site request header: same-origin, same-site, cross-site, or none for a navigation the user started directly. Our lab logged it on every request.

Which cookies the browser sent, measured

In one browser context we set six cookies on app.bank.test, all Secure and HttpOnly. Two were set first: old_unset, with no SameSite attribute, and old_lax, with SameSite=Lax. We waited 130 seconds and set four more: c_none (SameSite=None), c_lax (Lax), c_strict (Strict) and fresh_unset (no attribute). Chromium's cookie store, read through Playwright, reported both unset cookies as Lax.

We then sent seven kinds of request to an endpoint that only logs what arrives, from a page on evil.test, from a page on blog.bank.test, and from the application itself as a control. The seven were an auto-submitting form POST in the top-level window, a link clicked in the top-level window, a form POST inside an iframe, an iframe loading the URL, an image, a no-cors fetch POST with a text/plain body, and a fetch GET with credentials. The first cross-site request reached the server 0.18 seconds after the fresh cookies were set, and the whole matrix finished within 12 seconds.

Three things follow.

A cookie with no SameSite attribute was not the same as an explicit Lax cookie. Both were reported as Lax by the cookie store. Only the one without the attribute rode along on a cross-site POST, and only while it was young. This is the behaviour Chromium documents as "Lax + POST". Its SameSite FAQ says that "a cookie that is at most 2 minutes old will be sent on a top-level cross-site POST request", and calls it "purely a temporary solution" that "will be removed in the future". Its update log, in an entry dated 1 November 2019, says the intervention applies to "cookies that don't specify a SameSite attribute", and that "Normal" Lax cookies, meaning ones with the attribute set, "are not sent on cross-site POST requests". MDN's Set-Cookie reference describes the same two-minute allowance. We observed it in Chrome 153 on 6 November 2026. We measured one fresh age, under a second, and two old ages, 130 seconds for old_unset and for fresh_unset in the repeat, not the boundary.

The practical consequence is about timing. The two minutes after a cookie is set are the two minutes after the user logs in, which is when the user is active. A forged POST that arrives in that window, against an application whose session cookie has no SameSite attribute, carries the session. We measured that end to end below.

Lax let top-level GET navigations through. That is what Lax is meant to do, so that following a link into a site keeps you logged in. It is also why a state change on GET is not protected by Lax. The OWASP cheat sheet calls this "the single most common way SameSite-based defenses fail in practice"; that is OWASP's assessment, not something we measured.

Same-site meant every cookie. Nothing in SameSite distinguishes blog.bank.test from app.bank.test. Any subdomain that can be made to serve an attacker's page, through a dangling DNS record, an XSS on a marketing site, a user-content host or a forgotten staging box, defeats SameSite entirely, Strict included.

Two caveats about the browser. Our headless context attached SameSite=None cookies in every third-party position we tried. A Chrome profile that restricts third-party cookies, or a browser that partitions or blocks them, may not send c_none from an iframe, an image or a fetch. We did not test that. And MDN's reference says only that "some browsers" use Lax as the default, while the OWASP cheat sheet says that "Chromium-based browsers treat cookies without a SameSite attribute as Lax, but Firefox and Safari do not". We did not test that either. If it holds, a user of such a browser gets no SameSite protection for a session cookie that has no attribute, although a third-party cookie restriction may still keep the cookie off some subresource requests.

Token absence versus token enforcement

The second part of the lab isolates the token logic. Alice's session cookie was set with SameSite=None, so that the browser would attach it to every cross-site request and the server's check would be the only thing deciding. That is the position of any application whose session cookie has to be None, for example one embedded in a partner's site. Each endpoint changes the logged-in user's email address. Each form page renders the way the pattern implies. A page on evil.test submitted an auto-posting form to each one.

A check that decides by looking for a hidden field with a token-like name would read these seven forms like this. Fields are present on (b), (c), (d) and (j). Of those, only (j) resisted a forged request. Fields are absent on (a), (h) and (k). Of those, only (a) was exploitable. So field presence agreed with what the browser could actually do on 2 of the 7, (a) and (j). That count describes a lab built to contain these patterns, one of each, and says nothing about how often each pattern occurs in real applications. What it does show is that the field and the protection are different things. A field is how a token gets from the server into a form. The protection is a comparison on the server, and nothing in the HTML shows it.

Double-submit cookies and the sibling subdomain

Two more endpoints implement the "double-submit" pattern. The server sets the token in a cookie, and the form must send the same value as a field. The server compares the two and keeps no state.

The OWASP cheat sheet marks the naive pattern as discouraged, saying it "is bypassable by an attacker who can write cookies on the target domain (e.g., via a vulnerable sibling subdomain, DNS takeover, or plaintext-HTTP cookie injection on a non-__Host- cookie)", and recommends a signed token bound to the session.

JSON bodies, text/plain forms and preflight

A JSON API is often assumed to be immune, because a form cannot send application/json. Whether that holds depends on what the server does with a body that arrives with a different Content-Type. Two endpoints, both with Alice's SameSite=None session:

An HTML form with enctype="text/plain" sends each field as the name, an equals sign and the value, followed by a carriage return and line feed. The trick is a single field whose name is {"email":"[email protected]","pad":" and whose value is "}. The body that arrived was {"email":"[email protected]","pad":"="} followed by the line ending, with Content-Type: text/plain.

So the protection for (e1) came from two places: the server refused bodies it would not parse as JSON, and the browser would not send the JSON Content-Type cross-site without a preflight the server did not approve. Remove either and it is gone. (e2) removes the first. A CORS policy that reflects the origin with credentials removes the second, which the CORS post measured. That post also notes, from body-parser's source rather than from a test, that Express's usual JSON parser leaves a text/plain body unparsed by default. That is a parser default, not a CSRF control, and a handler that reads the raw body or a parser configured for every type gives it up.

State changes on GET, and SameSite as the only defence

Endpoint (f) changes the email address on a GET with the new address in the query string, with no token. We logged Alice in with each of three session cookies in turn and attacked it, and endpoint (a), from both attacker hosts.

With no token anywhere, SameSite was the whole defence, and each value left a specific gap: Lax left GET navigations and the first two minutes after login if the attribute was omitted, and every value left the sibling subdomain.

Login CSRF

The login form is where "no token" findings are most often dismissed, on the grounds that the user is not authenticated yet. The attack runs the other way. The attacker logs the victim's browser into the attacker's own account. The OWASP cheat sheet gives the example of a victim who then enters card details into what they believe is their own shopping account. Anything the victim does afterwards, a search history, a saved document, a linked payment method, lands in an account the attacker can read.

Our login endpoint takes a username and password, creates a session, and sets the session cookie with a SameSite value chosen per test: None, Lax, Strict or no attribute. For each, a fresh browser context with no cookies visited a page on evil.test that posted Mallory's credentials to the login form. Then the browser navigated to /whoami on the application.

SameSite decides which cookies are attached to a request. The forged login request carried no cookies and needed none. The cookie it produced arrived in the response to a top-level navigation, and Chromium stored it whatever its SameSite value. So the informational "login form without CSRF token" finding in the opening scenario was a real CSRF, and the Lax session cookie was not a reason to close it.

The OWASP cheat sheet says: "Login CSRF can be mitigated by creating pre-sessions (sessions before a user is authenticated) and including tokens in login form". It adds that the pre-session must be destroyed and a new session created at login, to avoid session fixation. A Sec-Fetch-Site or Origin check on the login handler is the other option. We did not build either into the lab's login endpoint.

What a scanner sees, measured

A cookie-attribute check

The nuclei-templates commit we used has no template under dast/ that mentions CSRF. The template that bears on it is missing-cookie-samesite-strict, which is severity info. It sends one GET to the URL it is given and matches if the response headers contain a Set-Cookie and do not contain samesite=strict anywhere. We gave it five lab URLs.

So on these five, it raised the Lax and unset cases, which may be deliberate choices, and was silent on the SameSite=None session cookie, the case that matters most for CSRF. It also does not distinguish an explicit Lax from a missing attribute, which behaved differently in Chromium. As its severity says, a cookie attribute is context, not a CSRF finding.

A replay without a browser

A scanner that tests CSRF by replaying a captured request with the token removed, or changed, is testing the token logic. That works for token defences, because the token is the only thing the server checks. We replayed against the lab with curl, with Alice's session cookie and no Origin or Sec-Fetch-* headers.

The (k) line is the trap. A replay without browser headers was accepted by an endpoint that refused every cross-site request Chromium sent, because a request with neither header looks like the kind of non-browser client that cannot carry a victim's cookies anyway. "The request was accepted without a token" is evidence of CSRF only when the replay reproduces what a cross-site browser would send. Against a header-based defence, that means sending the Origin and Sec-Fetch-Site values a browser would set. The fall-through when both are absent is a separate question: it matters for any browser that sends neither header, and the OWASP cheat sheet calls the Origin fallback for browsers without Fetch Metadata "a mandatory requirement".

Two more limits of a scan. Testing (d) needs two authenticated sessions, so a scan with one test account cannot find it. And a scan with no session at all sees the login page and the public forms, which is where login CSRF lives and not much else.

Confirming a finding by hand

The procedure below is general practice. It needs authorisation to test the target and should use test accounts you control. The proof of concept should change something harmless, on your own test account, and nothing else.

  1. Identify the credential. Read the Set-Cookie header that creates the session, not the browser's cookie store, which in our lab reported a missing attribute as Lax. Note the SameSite value or its absence, the Domain attribute, and any __Host- prefix. If the action is authorised by a header the application's JavaScript adds and not by a cookie, CSRF does not apply to it.
  2. Identify the defence from a legitimate request. Look for a token in the body, a token in a header, a check on Origin or Sec-Fetch-Site, and a strict Content-Type.
  3. Test the token logic by replay. Send the request with the token removed, empty, changed by one character, from a second test account's session, and after the session that issued it has logged out. Each should fail. (b), (c) and (d) above are the failures this finds.
  4. Test the body. Send the same parameters as application/x-www-form-urlencoded, as multipart/form-data and as text/plain, and a JSON body as text/plain. Anything accepted can come from a form.
  5. Test the method. Try the action as a GET. If it works, Lax does not protect it.
  6. Build a proof-of-concept page on a host you control on a different registrable domain: an auto-submitting form for a POST, a link for a GET. Load it in a browser where the test account is logged in, and check the effect on the server. If any sibling subdomain is in scope, repeat from there, because it is same-site.
  7. Mind the clock in Chromium. If the session cookie has no SameSite attribute, a cross-site POST within two minutes of login carries it and one after does not. Test both, and report which one you saw.
  8. Name the browsers. Defaults for cookies without a SameSite attribute, and third-party cookie handling, differ between browsers and profiles. A proof in Chromium is a proof in Chromium.
  9. For login, start with no session. Post the attacker account's credentials from your page, then load the application and see whose account it shows.
  10. Keep the evidence: the Set-Cookie header, the proof-of-concept page, the server-side effect, the browser and version, and the time since login.

The fix

All of this is general practice, except where it says it was measured.

The static side

In source, CSRF is mostly the absence of a check, which is harder for a rule to see than the presence of a dangerous call. What static analysis can find well is the explicit opt-out: a CSRF middleware disabled in configuration, an exemption decorator or attribute on a route, a route that changes state on GET, or a JSON parser configured to accept every content type.

Each of those has a legitimate case, and a rule that flags them by name will be wrong in a predictable way. A webhook endpoint authenticated by an HMAC signature, or an API that only accepts a bearer header, is correctly exempt, because no browser attaches its credential. A flag on every exemption without reading how the route authenticates is the same mistake the SAST false-positive post describes for sink matching: the pattern matched, the condition that makes it dangerous was never checked. The opposite error is harder. A hand-written check like (c) or (d) can read as protection to a rule looking for a token comparison, and finding the flaw means following the logic. We did not run a static rule against the lab.

What source does not show:

A triage checklist for a DAST CSRF finding

  1. Is the action authorised by a credential the browser attaches by itself? If it uses a header the application sets, it is not CSRF.
  2. Does the finding show that a forged request succeeded, or only that a form lacks a field?
  3. Is the token enforced? Removed, changed, from another session, after logout.
  4. Does the endpoint accept a body a form can send, including JSON as text/plain?
  5. Does the action work as a GET?
  6. What does the session cookie's Set-Cookie say about SameSite, and was the proof taken inside the two minutes after login?
  7. Which sibling subdomains exist, and could any of them serve an attacker's page?
  8. For a header-based defence, did the replay send the Origin and Sec-Fetch-Site a browser would? And what happens when both are absent?
  9. For a clean result: did the scan have a session, two sessions for cross-session token tests, and coverage of the login form and the JSON endpoints? The scan-passed post and the crawler-coverage post cover what a scan never reached.
  10. Retest after the fix with the proof-of-concept page, in a named browser, from a cross-site host and from a same-site one.

The hypothetical findings, resolved

Back to the four hypothetical findings.

/account/email. In the scenario, the medium was a false positive. A replay without the X-CSRF-Token header got 403, and a proof-of-concept form from a test domain got 403 as well. It was closed with both requests attached and a note naming the header as the defence, so the next scan's identical finding could be matched to the evidence.

/account/password. In the scenario, nothing was reported, and the endpoint was vulnerable. A replay with the token field removed changed the test account's password. The handler's check was rewritten to fail when the token is missing, and the team searched for the same pattern in other handlers.

/api/transfer. In the scenario, the "not applicable" note was wrong. A text/plain form with a JSON body moved a test amount between two test accounts. The endpoint was changed to require application/json, and the CORS policy was checked to make sure it did not approve arbitrary origins with credentials.

/login. In the scenario, the informational finding was real. A page on a test domain logged a fresh browser into the tester's second account, and the Lax session cookie made no difference. The login form now carries a pre-session token, and the session is replaced at login.

Where AppSecD fits

AppSecD's dynamic and API testing runs Nuclei, Dalfox, SQLMap, Commix, Katana, Arjun, FFuf and Interactsh for out-of-band detection, plus 150+ native checks and API discovery across 50+ web frameworks. Its static analysis includes dataflow taint analysis that traces source to sink across functions. Its findings are deduplicated across scans and move through new, reopened and fixed states, with maker-checker approval so a finding cannot be closed unilaterally.

That is the whole claim. data/products.ts is the single source of truth for what these products do. It names Nuclei, and it does not mention CSRF, SameSite, anti-forgery tokens or cookie attributes. So this post does not claim that AppSecD tests for CSRF. Nor does it claim anything about:

The measurements, the confirmation procedure, the fixes and the checklist above are general practice, not a description of how AppSecD works internally, and they apply to any scanner's output, ours included. The scenario in this post is hypothetical and does not describe any AppSecD deployment, user or finding.

More about AppSecD · All posts