M365Con 2027 – free online conference · 11–22 Jan 2027 · 120 sessions m365con.net

Blog · Mirko Peters

OWASP Top 10 2025 for .NET: 3 Risks and ASP.NET Core Fixes

By · · 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 categoryChange vs 2021
A01Broken Access ControlStays #1, SSRF rolled in
A02Security MisconfigurationUp from #5
A03Software Supply Chain FailuresNew, expands Vulnerable and Outdated Components
A04Cryptographic FailuresDown from #2
A05InjectionDown from #3
A06Insecure DesignDown from #4
A07Authentication FailuresStays #7, renamed from Identification and Authentication Failures
A08Software or Data Integrity FailuresStays #8
A09Security Logging and Alerting FailuresStays #9, renamed to stress alerting
A10Mishandling of Exceptional ConditionsNew

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. SetFallbackPolicy with RequireAuthenticatedUser() protects every new endpoint; mark public ones with AllowAnonymous(). Files served by the static file middleware before the authorization middleware stay public, so keep sensitive files outside wwwroot.
  • Rate limit. AddRateLimiter and RequireRateLimiting (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. Set RejectionStatusCode to 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:

WarningSeverity
NU1901Low
NU1902Moderate
NU1903High
NU1904Critical

Things to know before you rely on it:

  • Transitive packages. NuGetAuditMode defaults to all only for projects that target net10.0 or later. Older targets default to direct, 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;NU1904 to WarningsAsErrors so high and critical findings stop the pipeline.
  • Manual check. dotnet list package --vulnerable --include-transitive. Microsoft notes that --include-transitive is not the default.
  • Suppress with care. NuGetAuditSuppress hides an advisory entirely. Microsoft calls it a last resort.
  • Locked-down networks. If api.nuget.org is blocked, point auditSources (NuGet 6.12, .NET 9 SDK, Visual Studio 17.12 and later) to data.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 2025ASP.NET Core controlCheck in CI
A01 Broken Access ControlFallback policy, AuthorizeAsync per resource, rate limitingTest: user A can't read user B's record
A02 MisconfigurationUseExceptionHandler, no dev-only endpointsNo stack trace in a production 500
A03 Supply Chain FailuresNuGet Audit with all, WarningsAsErrorsBuild 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

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.

Entities in this article

Topics of this article:

OWASP – Organization ASP.NET Core – Product .NET – Developer tool by Microsoft NuGet – Product Software supply chain security – Concept

Related articles

More articles on .NET:

RSS