ASP.NET Core (.NET 8/9) · CWE-362

ASP.NET Core: TOCTOU & Concurrency Race Conditions

Stop concurrent requests from double-spending balances, reusing single-use coupons, or bypassing step quotas. Applied specifically to ASP.NET Core: Apply AuthorizationHandler policies and EF Core parameterized queries.

Primary AegisSec skill
business-logic-race-testing ->
Companion: owasp-api-graphql-audit
Coverage ledger tracking key
surface:aspnet-core::boundary:race-condition-toctou::principal:User.FindFirstValue(ClaimTypes.NameIdentifier)
Parallel HTTP/2 burst verification comparing invariant balance/quota conservation
Risk boundary
// Unverified ASP.NET Core path (CWE-362)
// Handler accepts client input without validating User.FindFirstValue(ClaimTypes.NameIdentifier) or boundary invariants before sink.
Hardened guard
// Hardened ASP.NET Core pattern (CWE-362)
// 1. Apply AuthorizationHandler policies and EF Core parameterized queries
// 2. Move balance/quota assertions into atomic database conditional UPDATE predicates or row-level locks.

Verification steps

  1. 01Seed coverage-ledger.json for every ASP.NET Core route handling this boundary.
  2. 02Inspect the code trace from request input down to the persistence or egress sink.
  3. 03Confirm with paired User A vs User B requests (or staging baseline-vs-payload replay) via owasp-api-graphql-audit.