📁 Sangam Dhakal - Portfolio v2.0 - Netscape Navigator 4.0
_
□
×

📚 Interview question

What is the OWASP Top 10? Walk me through the current edition and tell me, for each category, what ASP.NET Core gives you by default and what you still have to do yourself.

The OWASP Top 10:2025 categories mapped to the built-in ASP.NET Core defences and the gaps a developer must still close.

Junior Theory Beginner aspnet-core owasp owasp-top-10 secure-coding security web-security

🎯 Key points

  • OWASP Top 10:2025 is the current edition (presented Nov 2025, final published early 2026; it replaced the 2021 list)
  • A01 Broken Access Control is still #1 and now absorbs SSRF
  • A03 Software Supply Chain Failures and A10 Mishandling of Exceptional Conditions are new in 2025
  • Framework defaults: Razor encoding, EF Core parameterisation, antiforgery, Identity's PBKDF2 hashing, Data Protection
  • Developer-owned: object-level authorisation, configuration hardening, dependency hygiene, logging and alerting
  • Business-logic flaws sit outside any list: threat modelling and a secure SDLC catch them
  • It is an awareness document, not a checklist; use OWASP ASVS for verifiable requirements
  • OWASP API Security Top 10 (2023) for APIs, where BOLA is #1

⏱ 30-second answer

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.

🗣 Full answer (senior)

How I would answer this in an interview

"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 FromSql as 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."


The 2025 list mapped to ASP.NET Core

# 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

Related lists you should name

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

Production example

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.

🔍 What the interviewer is checking

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

  • Names the 2025 edition and what changed (SSRF merged into A01, two new categories)
  • Separates framework defaults from developer responsibilities
  • Mentions object-level authorisation and the API Security Top 10
  • Knows the list is awareness, ASVS is requirements

Red flags

  • Recites the 2017 or 2021 list as current
  • Thinks [Authorize] or EF Core alone makes an app secure
  • Cannot give a .NET example for any category

📚 Learn in depth

1. Where the list comes from

The 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.

2. What changed from 2021 to 2025

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.

3. Defence in depth in an ASP.NET Core request

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.

4. Secure defaults and how they get switched off

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.

5. Using the list well

  • Training and shared vocabulary: yes.
  • Requirements and test cases: use ASVS levels instead.
  • Prioritisation: combine with your own threat model; your top risk may be a business-logic flaw that no list names.

Try it yourself

  1. Open the OWASP Top 10:2025 site and, for each category, write one line on where it lives in your current codebase.
  2. Grep a repo for Html.Raw, FromSqlRaw, AllowAnyOrigin, IgnoreAntiforgeryToken, TypeNameHandling and review each hit.
  3. Run OWASP ZAP baseline scan against a local app and map each alert to a Top 10 category.
  4. Run dotnet list package --vulnerable --include-transitive and note which findings fall under A03.
  5. Turn off the developer exception page guard in a test app and see what an attacker learns from a 500 (then put it back).

💻 Code

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);

⚠ Common mistakes

  • Mistake: Quoting the 2021 list (with SSRF at A10 and 'Vulnerable and Outdated Components' at A06) as current. Why it is wrong: the 2025 edition, finalised in early 2026, merged SSRF into A01 and added Software Supply Chain Failures and Mishandling of Exceptional Conditions. Interviewers who follow AppSec will notice. Instead: name the 2025 list, and know the 2021 one well enough to explain what changed.
  • Mistake: Treating the Top 10 as a checklist to sign off. Why it is wrong: it is an awareness document with no testable requirements, and it says nothing about your business logic. Instead: use OWASP ASVS for requirements and test cases, and a threat model for logic flaws such as refund abuse or coupon stacking.
  • Mistake: Assuming [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.
  • Mistake: Believing EF Core makes SQL injection impossible. Why it is wrong: FromSqlRaw and ExecuteSqlRaw with concatenated strings are injectable. Instead: use FromSql with interpolation or explicit parameters.
  • Mistake: Leaving Swagger UI or the developer exception page on in production. Why it is wrong: it hands attackers your attack surface and stack traces (A02, A10). Instead: guard them with the environment and test the guard.
  • Mistake: Ignoring dependency warnings because 'it's a transitive package'. Why it is wrong: transitive packages run in your process with your permissions (A03). Instead: enable NuGetAudit for transitive packages and fail CI on high severity.
  • Mistake: Using only the web Top 10 for an API. Why it is wrong: APIs have distinct risks such as BOLA and unrestricted resource consumption. Instead: also use the OWASP API Security Top 10.
  • Mistake: Treating security as a pre-release pen test only. Why it is wrong: most Top 10 issues are cheapest to prevent at design and code review. Instead: build it into the lifecycle: threat modelling, analysers, dependency scanning in CI, security tests, then pen testing.

🏛 Senior insight: trade-offs

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.

🔗 Follow-ups the interviewer may ask

  1. When: Candidate says Broken Access Control is number one Why: Checks they can fix object-level authorisation in a real API, not just name it
    How to answer

    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.

    • Fix the endpoint: scope the query by the caller, with 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.
    • Fix the codebase: enumerate every endpoint that takes an id, including child resources and exports; add tenant query filters and optionally row-level security as a safety net.
    • Prevent: cross-user integration tests in CI, a load-and-authorise helper, scheduled access-control reviews and logging that detects enumeration.

    The trade-off: random ids slow attackers down, but they are not authorisation; only a server-side ownership check is.

  2. When: Candidate says EF Core prevents SQL injection Why: Checks they know the raw SQL escape hatches where injection still happens
    How to answer

    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.

More in Web Security

Last updated 23 Nov 2026.

🌐 Sangam's Webring

⏪ Previous 🏠 Main Next ⏩
💬 Chat with me