The OWASP Top 10:2025 categories mapped to the built-in ASP.NET Core defences and the gaps a developer must still close.
The OWASP Top 10 is a ranked awareness list of the most critical web application risks, based on contributed data and a community survey. The current edition is OWASP Top 10:2025: A01 Broken Access Control, A02 Security Misconfiguration, A03 Software Supply Chain Failures (new), A04 Cryptographic Failures, A05 Injection, A06 Insecure Design, A07 Authentication Failures, A08 Software or Data Integrity Failures, A09 Security Logging and Alerting Failures and A10 Mishandling of Exceptional Conditions (new).
ASP.NET Core covers some of these by default (Razor output encoding, parameterised EF Core queries, antiforgery tokens, PBKDF2 password hashing in Identity), but the top risks — access control, configuration and dependencies — are your code and your pipeline. The trade-off: the framework makes the secure path easy, but it cannot know who should see which record.
"The OWASP Top 10 is a ranked awareness list of the most critical web application security risks. The current edition is the 2025 one: it was presented at OWASP Global AppSec in November 2025 and finalised early in 2026. Broken Access Control is still number one, and it now absorbs server-side request forgery. Security Misconfiguration moved up to second, and there are two new categories: Software Supply Chain Failures at A03 and Mishandling of Exceptional Conditions at A10. Injection, which includes XSS, dropped to fifth.
In ASP.NET Core a lot of the injection and crypto risk is handled for me if I stay on the default path. Razor HTML-encodes output, EF Core sends LINQ and interpolated
FromSqlas parameters, antiforgery is built into forms, Identity hashes passwords with PBKDF2, and Data Protection encrypts cookies. What the framework can't do is decide that customer 42 may not read order 43, keep my NuGet packages patched, or stop me shipping the developer exception page to production. Those are the categories at the top of the list.The mistake I see is treating the Top 10 as a compliance checklist: 'we've ticked all ten, so we're secure'. It's an awareness document. For actual requirements I'd use the OWASP ASVS, and for APIs the OWASP API Security Top 10, where broken object-level authorisation is number one. The framework gives you safe defaults; the top risks are the ones only your design can fix."
| # | Category | What ASP.NET Core gives you | What you still own |
|---|---|---|---|
| A01 | Broken Access Control (incl. SSRF) | [Authorize], policies, IAuthorizationService, fallback policy |
Object-level checks, tenant filters, deny-by-default, URL allow-lists for outbound calls |
| A02 | Security Misconfiguration | Environment-aware templates, UseHsts, UseExceptionHandler |
Headers, CORS policy, disabling Swagger/dev pages in prod, cloud config |
| A03 | Software Supply Chain Failures | NuGetAudit warnings on restore, package signing | Lock files, source mapping, Dependabot, SBOM, CI permissions |
| A04 | Cryptographic Failures | Data Protection, AesGcm, Identity PasswordHasher |
TLS everywhere, key management, not rolling your own crypto |
| A05 | Injection (SQL, XSS, command) | Razor encoding, EF Core parameters | Raw SQL, Html.Raw, dynamic ORDER BY, shell calls |
| A06 | Insecure Design | — | Threat modelling, abuse cases, rate limits on business flows |
| A07 | Authentication Failures | Identity lockout, MFA, passkeys (.NET 10), JWT bearer validation | Correct token validation settings, session revocation |
| A08 | Software or Data Integrity Failures | BinaryFormatter removed (.NET 9), signed packages | Safe deserialisation, signed artefacts, webhook signature checks |
| A09 | Security Logging and Alerting Failures | ILogger, OpenTelemetry |
Logging security events, alerting on them, never logging secrets |
| A10 | Mishandling of Exceptional Conditions | UseExceptionHandler, ProblemDetails |
Failing closed, no stack traces to clients, consistent error paths |
| List | Use it for |
|---|---|
| OWASP API Security Top 10 (2023) | APIs: BOLA (#1), broken authentication, unrestricted resource consumption |
| OWASP ASVS | Verifiable requirements for design and test |
| OWASP Cheat Sheet Series | Concrete how-tos per topic |
| ACSC Essential Eight / ISM | Australian government and regulated clients |
In an external pen test of a typical line-of-business API, findings usually cluster in A01 and A02: an endpoint that returned any order by id (BOLA) and a Swagger UI left enabled in production. Neither was a framework bug; both were fixed in under a day with a resource-based authorisation check and an environment guard, and an integration test per endpoint stopped them coming back.
Checks that the candidate knows the current list and can connect each risk to concrete ASP.NET Core mechanisms rather than reciting names.
Green flags
Red flags
[Authorize] or EF Core alone makes an app secureThe Top 10 combines contributed data (vulnerability findings from testing organisations, mapped to CWEs) with a community survey for risks that testing data under-represents. Each category groups related CWEs. That is why categories are broad ("Injection" covers SQL, OS command and XSS) and why the ranking reflects incidence across tested apps, not severity in your app.
2021 2025
A01 Broken Access Control -> A01 Broken Access Control (+ SSRF)
A05 Security Misconfiguration -> A02 Security Misconfiguration
A06 Vulnerable Components -> A03 Software Supply Chain Failures (broader)
A02 Cryptographic Failures -> A04 Cryptographic Failures
A03 Injection -> A05 Injection
A04 Insecure Design -> A06 Insecure Design
A07 Identification & Auth -> A07 Authentication Failures
A08 Integrity Failures -> A08 Software or Data Integrity Failures
A09 Logging & Monitoring -> A09 Security Logging and Alerting Failures
A10 SSRF -> (merged into A01)
(new) -> A10 Mishandling of Exceptional Conditions
The shift tells a story: frameworks have made injection rarer, while configuration, cloud and dependency risks have grown.
Browser -> TLS/HSTS -> WAF/Front Door -> Kestrel
-> UseExceptionHandler (A10: fail safely)
-> UseHsts / headers (A02)
-> UseCors (A02)
-> UseAuthentication (A07)
-> UseAuthorization (A01 endpoint level)
-> UseAntiforgery (CSRF)
-> handler: resource check (A01 object level)
EF Core params (A05)
Razor encoding (A05 XSS)
-> logging + alerts (A09)
Each layer catches what the previous one cannot. Endpoint-level [Authorize] cannot know whether this order belongs to this user; only the handler can.
Most real vulnerabilities in ASP.NET Core apps come from turning a default off: Html.Raw, FromSqlRaw with concatenation, [IgnoreAntiforgeryToken], AllowAnyOrigin, ValidateIssuer = false, TypeNameHandling.All. A useful review habit is to grep for these "escape hatches" and require a justification for each.
Html.Raw, FromSqlRaw, AllowAnyOrigin, IgnoreAntiforgeryToken, TypeNameHandling and review each hit.dotnet list package --vulnerable --include-transitive and note which findings fall under A03.A minimal Program.cs showing the defaults that cover several Top 10 categories, with comments on what each line is for.
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddProblemDetails(); // A10: consistent, safe error bodies
builder.Services.AddAuthentication().AddJwtBearer(); // A07: validated tokens
builder.Services.AddAuthorization(o =>
{
// A01: deny by default; endpoints must opt out explicitly with AllowAnonymous
o.FallbackPolicy = new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build();
});
builder.Services.AddCors(o => o.AddPolicy("spa", p => p
.WithOrigins("https://app.example.com.au") // A02: explicit origins, never AllowAnyOrigin
.WithMethods("GET", "POST")
.WithHeaders("Authorization", "Content-Type")));
var app = builder.Build();
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler(); // A10/A02: no stack traces to clients
app.UseHsts(); // A04/A02: browsers stick to HTTPS
}
app.UseHttpsRedirection();
app.UseCors("spa");
app.UseAuthentication();
app.UseAuthorization();
app.MapGet("/orders/{id:int}", async (int id, ClaimsPrincipal user, OrdersDb db, CancellationToken ct) =>
{
var customerId = user.FindFirstValue("customer_id");
// A01 object level + A05: EF Core parameterises both values
var order = await db.Orders
.Where(o => o.Id == id && o.CustomerId == customerId)
.Select(o => new OrderDto(o.Id, o.Total))
.FirstOrDefaultAsync(ct);
return order is null ? Results.NotFound() : Results.Ok(order);
});
app.Run();
public sealed record OrderDto(int Id, decimal Total);
[Authorize] solves Broken Access Control. Why it is wrong: it only proves the caller is authenticated or has a role, not that they own the record. Instead: add resource-based checks or query filters per object.FromSqlRaw and ExecuteSqlRaw with concatenated strings are injectable. Instead: use FromSql with interpolation or explicit parameters.The useful senior framing is: frameworks have mostly solved the bottom of the list; the top of the list is about design, configuration and supply chain. ASP.NET Core's defaults handle encoding, parameterisation, CSRF tokens and password hashing well. The risks that remain are the ones requiring context the framework doesn't have: who owns which record, which environment you are in, which packages you trust.
| Approach | When it fits | Cost | When not to |
|---|---|---|---|
| OWASP Top 10 | Training, shared vocabulary, prioritising awareness | Low | As a sign-off checklist |
| OWASP ASVS (L1–L3) | Requirements, test plans, vendor assessments | Medium | Tiny prototypes |
| OWASP API Top 10 | Any public or partner API | Low | Pure server-rendered sites |
| Essential Eight / ISM | Australian government, regulated industries | High | Not a substitute for app-level controls |
Measure it: track pen-test findings by category over time, the count of 'escape hatch' usages in code, and mean time to patch vulnerable dependencies.
Broken object-level authorisation (BOLA, also called IDOR) is API1:2023 in the OWASP API Security Top 10: the API checks who you are but not whether this object is yours.
callerId read from the token's claims, never from the request (Where(o => o.Id == id && o.CustomerId == callerId)), or load and call IAuthorizationService.AuthorizeAsync when roles or teams are involved; return 404, not 403.The trade-off: random ids slow attackers down, but they are not authorisation; only a server-side ownership check is.
Use raw SQL for what LINQ can't express well: hints, window functions, full-text search, table-valued functions or stored procedures. FromSql($"... {id}") takes a FormattableString, so every interpolation hole becomes a DbParameter; that is the safe default. FromSqlRaw takes a plain string and is safe only with explicit @p parameters: passing $"...{input}" to it concatenates the value into SQL, which is SQL injection (EF Core 8's EF1002 analyser warns about it). SqlQuery<T> returns scalars or unmapped DTOs, and ExecuteSql runs commands. Identifiers such as sort columns can never be parameters, so whitelist them. A composable SELECT can have LINQ added on top (EF wraps it as a subquery), but EXEC cannot. The trade-off is power and performance versus losing compile-time checking, so keep raw SQL small and tested.
Last updated 23 Nov 2026.