Disabled CSRF protection (ARCH322)
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
Key dotnet.security.disabled-csrf · Severity error · Category security · CWE CWE-352
Using [IgnoreAntiforgeryToken] on a state-changing endpoint removes antiforgery (CSRF) protection. This lets attackers trigger unwanted requests using a victim’s authenticated session.
Incorrect
Section titled “Incorrect”[HttpPost][IgnoreAntiforgeryToken]public IActionResult TransferFunds(TransferModel model){ _bank.Transfer(model); return RedirectToAction("Index");}Correct
Section titled “Correct”[HttpPost][ValidateAntiForgeryToken]public IActionResult TransferFunds(TransferModel model){ _bank.Transfer(model); return RedirectToAction("Index");}Remove [IgnoreAntiforgeryToken] and apply [ValidateAntiForgeryToken] to all state-changing POST/PUT/DELETE actions.