OWASP Top 10 2025 for .NET: 3 Risks and ASP.NET Core Fixes
By Mirko Peters · · Updated
The OWASP Top 10 2025 for .NET developers: what changed since 2021, and concrete ASP.NET Core fixes for broken access control, software supply chain failures and security misconfiguration.
The OWASP Top 10 2025 is the successor to the 2021 list, and it shifts weight from single lines of code toward architecture and ecosystem. For .NET teams, three entries stand out: Broken Access Control stays at #1, Security Misconfiguration jumps to #2, and Software Supply Chain Failures is new at #3. Below: what changed, then the ASP.NET Core controls for each of the three.
Key points
- Broken Access Control stays at #1 in the OWASP Top 10 2025, and SSRF has been rolled into it.
- Software Supply Chain Failures is new at #3 and expands the 2021 category Vulnerable and Outdated Components.
- Security Misconfiguration moved up from #5 to #2. Mishandling of Exceptional Conditions is new at #10.
- [Authorize] runs before the resource is loaded, so per-record checks need IAuthorizationService.AuthorizeAsync.
- NuGet Audit runs on restore. For projects that target net10.0 or later it checks transitive packages by default; set NuGetAuditMode to all for net8.0 and net9.0.
- Never enable the Developer Exception Page outside the Development environment.
What changed in the OWASP Top 10 2025
| # | 2025 category | Change vs 2021 |
|---|---|---|
| A01 | Broken Access Control | Stays #1, SSRF rolled in |
| A02 | Security Misconfiguration | Up from #5 |
| A03 | Software Supply Chain Failures | New, expands Vulnerable and Outdated Components |
| A04 | Cryptographic Failures | Down from #2 |
| A05 | Injection | Down from #3 |
| A06 | Insecure Design | Down from #4 |
| A07 | Authentication Failures | Stays #7, renamed from Identification and Authentication Failures |
| A08 | Software or Data Integrity Failures | Stays #8 |
| A09 | Security Logging and Alerting Failures | Stays #9, renamed to stress alerting |
| A10 | Mishandling of Exceptional Conditions | New |
A lower rank does not mean a solved problem. Injection fell two places but is still listed.
Risk 1: Broken Access Control and IDOR in ASP.NET Core
OWASP reports that 100% of tested applications had some form of broken access control. The classic case is an insecure direct object reference: a signed-in user changes an ID in the URL and gets someone else's record.
The pitfall in ASP.NET Core is that [Authorize] feels like enough. Microsoft Learn is clear: attribute evaluation happens before data binding and before any method that loads the resource. [Authorize] can tell you the caller is signed in, not that the caller owns record 42. For that, use resource-based (imperative) authorization:
app.MapGet("/documents/{id:guid}", async (Guid id, ClaimsPrincipal user,
IAuthorizationService auth, AppDbContext db) =>
{
var doc = await db.Documents.FindAsync(id);
if (doc is null) return Results.NotFound();
var result = await auth.AuthorizeAsync(user, doc, "SameAuthorPolicy");
return result.Succeeded ? Results.Ok(doc) : Results.NotFound();
});
The {id:guid} constraint only separates routes. The owner check is the real control. The policy is backed by an AuthorizationHandler<SameAuthorRequirement, Document> that compares the user with the record owner.
Three more steps match OWASP's "deny by default" advice:
- Set a fallback policy. By default the fallback policy is
null, so endpoints without authorization metadata are open.SetFallbackPolicywithRequireAuthenticatedUser()protects every new endpoint; mark public ones withAllowAnonymous(). Files served by the static file middleware before the authorization middleware stay public, so keep sensitive files outsidewwwroot. - Rate limit.
AddRateLimiterandRequireRateLimiting(ASP.NET Core 7 and later) slow down ID enumeration. Rejected requests get 503 Service Unavailable by default, which looks like an outage to clients and monitoring. SetRejectionStatusCodeto 429 Too Many Requests. - Log failed checks. OWASP asks you to log access control failures and alert on repeated attempts.
My rule of thumb: for records the caller may not see, return NotFound() instead of Forbid(). A 403 confirms the ID exists, which helps an attacker enumerate valid IDs.
Risk 2: Software Supply Chain Failures and NuGet
A03 covers compromises in how software is built, distributed and updated. It was the top concern in the OWASP community survey, with 50% of respondents ranking it first. OWASP explicitly calls out transitive dependencies, SBOMs, signed packages and trusted sources.
For .NET, the built-in tool is NuGet Audit. It runs during restore (NuGet 6.8, .NET 8 SDK, Visual Studio 2022 17.8 and later) and raises warnings by severity:
| Warning | Severity |
|---|---|
| NU1901 | Low |
| NU1902 | Moderate |
| NU1903 | High |
| NU1904 | Critical |
Things to know before you rely on it:
- Transitive packages.
NuGetAuditModedefaults toallonly for projects that targetnet10.0or later. Older targets default todirect, which skips the nested packages OWASP warns about. Set<NuGetAuditMode>all</NuGetAuditMode>on .NET 8 and 9 projects. - Make it fail the build. Add
NU1903;NU1904toWarningsAsErrorsso high and critical findings stop the pipeline. - Manual check.
dotnet list package --vulnerable --include-transitive. Microsoft notes that--include-transitiveis not the default. - Suppress with care.
NuGetAuditSuppresshides an advisory entirely. Microsoft calls it a last resort. - Locked-down networks. If
api.nuget.orgis blocked, pointauditSources(NuGet 6.12, .NET 9 SDK, Visual Studio 17.12 and later) todata.nuget.org, a vulnerability-data-only index.
My recommendation: generate an SBOM for every release and keep it with the build artifact. Microsoft's open-source SBOM Tool (dotnet tool install --global Microsoft.Sbom.DotNetTool) creates SPDX files. Knowing what you shipped is the inside view; Microsoft Defender EASM shows what is exposed from the outside.
Risk 3: Security Misconfiguration and error handling
Security Misconfiguration moved from #5 to #2. OWASP lists unnecessary features left on, default accounts, sample apps in production and stack traces returned to users.
In ASP.NET Core, the most common version is the Developer Exception Page. Apps built with WebApplication.CreateBuilder enable it automatically only in the Development environment. Microsoft Learn warns not to enable it anywhere else. In production, use UseExceptionHandler with AddProblemDetails, and an IExceptionHandler for known exceptions. IExceptionHandler implementations never run unless UseExceptionHandler is called. This addresses part of the new A10, Mishandling of Exceptional Conditions. The rest is in your own code: a catch block must never fail open, for example by granting access when a permission lookup throws.
The same applies to a diagnostic or debug endpoint left mapped in production. Map it only inside if (app.Environment.IsDevelopment()).
A short .NET checklist
| OWASP 2025 | ASP.NET Core control | Check in CI |
|---|---|---|
| A01 Broken Access Control | Fallback policy, AuthorizeAsync per resource, rate limiting | Test: user A can't read user B's record |
| A02 Misconfiguration | UseExceptionHandler, no dev-only endpoints | No stack trace in a production 500 |
| A03 Supply Chain Failures | NuGet Audit with all, WarningsAsErrors | Build fails on NU1903/NU1904 |
My recommendation: if you add only one control this week, write the cross-user test. Scanners find outdated packages, but they rarely notice that one user can read another user's data. In a WebApplicationFactory integration test, seed two users, sign in as the first with a test authentication handler, request the second user's record and assert it is refused.
Sources
- OWASP Top 10:2025 (OWASP)
- Introduction: what changed in 2025 (OWASP)
- A01:2025 Broken Access Control (OWASP)
- A02:2025 Security Misconfiguration (OWASP)
- A03:2025 Software Supply Chain Failures (OWASP)
- Resource-based authorization in ASP.NET Core (Microsoft Learn)
- Policy-based authorization in ASP.NET Core (Microsoft Learn)
- Rate limiting middleware in ASP.NET Core (Microsoft Learn)
- Routing in ASP.NET Core (Microsoft Learn)
- Handle errors in ASP.NET Core (Microsoft Learn)
- Integration tests in ASP.NET Core (Microsoft Learn)
- RateLimiterOptions.RejectionStatusCode (Microsoft Learn)
- Microsoft SBOM Tool (GitHub)
- Auditing package dependencies for security vulnerabilities (Microsoft Learn)
FAQ
What is new in the OWASP Top 10 2025?
Two categories are new: A03 Software Supply Chain Failures, which expands the 2021 category Vulnerable and Outdated Components, and A10 Mishandling of Exceptional Conditions. SSRF was rolled into A01 Broken Access Control, and Security Misconfiguration moved from #5 to #2.
Is injection still in the OWASP Top 10 2025?
Yes. Injection fell from #3 to #5, but it is still on the list. A lower rank reflects the data, not a solved problem, so keep using parameterized queries.
Does [Authorize] protect against IDOR in ASP.NET Core?
No. Microsoft Learn notes that attribute evaluation happens before data binding and before the resource is loaded. To check that a user may access a specific record, load it and call IAuthorizationService.AuthorizeAsync with the resource.
How do I scan a .NET project for vulnerable NuGet packages?
NuGet Audit runs during restore from the .NET 8 SDK on and raises warnings NU1901 to NU1904 by severity. For a manual check, run dotnet list package --vulnerable --include-transitive, because transitive packages are not included by default.
Should route constraints like {id:int} be used for input validation?
No. Microsoft Learn says route constraints are for disambiguating routes. Invalid input then returns 404 instead of a 400 with a useful error. Validate in the handler or through model binding.