Skip to content

14 min read

OWASP Top 10 2025 explained with examples

In one sentence: The OWASP Top 10 is the list of the ten most serious risks for web applications, and the 2025 one starts with broken access control. You've already closed almost all of them in the shop: this lesson puts them in order, like a map, and checks what's left: the headers, the packages and the logs.

What you will learn

  • Explain what OWASP is and what its Top 10 is for, and what it isn't for.
  • Recognize each risk of the Top 10:2025 and of the API Top 10, and say where you closed it in the shop.
  • Check an API's security headers and read the npm audit report without breaking the project.
  • Log security events without writing secrets to the log.

Before you start, read: 08-rate-limiting.md

Imagine a bookstore chain wants to sell Ana and Luis’s products through their API. Before signing, it sends them a security questionnaire that starts like this: “How does your API cover the risks of the OWASP Top 10?”

Ana has eight lessons of defenses: hashed passwords, sessions, roles, parameters, limits… But she added them one by one, as each problem came up. Is a whole family of flaws missing? And how does she explain it to someone who hasn’t read her code?

She needs a map: a short list of the flaws that come up most often, with names everyone knows.

The analogy

A car’s safety inspection, which many countries require, doesn’t check everything: it looks at the points that cause the most accidents, like the brakes and the lights. The list comes from years of data, and in any garage “failed on brakes” means the same thing.

The OWASP Top 10 is that list for web applications: the ten most serious kinds of flaw, each with a name everyone recognizes.

Where the analogy breaks down

  • You pass or fail the inspection. The Top 10 isn’t a certificate: it’s a list to raise awareness. To check point by point, OWASP has another guide, the ASVS.
  • The car doesn’t change between two inspections. Your code changes every week: the review never ends.

OWASP: a foundation that shares what it knows

Section titled “OWASP: a foundation that shares what it knows”

OWASPOWASP stands for Open Worldwide Application Security Project.An open community, backed by a nonprofit foundation, that publishes free guides and tools for building secure web applications. Its best-known document is the OWASP Top 10, the list of the ten most serious risks for web applications.Go to definition is an open application security community, backed by a nonprofit foundation. Almost all the work is done by volunteers, it doesn’t depend on any company and everything it publishes is free.

You already know it: its short guides, the cheat sheets, are in the “Further reading” of almost every lesson in this phase, like the one on passwords in lesson 1.

Its best-known document is the Top 10, the ten most serious risks for web applications; the 2025 edition is the eighth. Each risk groups many similar flaws. Almost all of them come from data on tests of real applications; two come from a survey of professionals, because tests barely detect them.

The list, taken from the Top 10 website on October 14, 2026:

Risk In one sentence Where you’ve seen it
A01 Broken Access Control Someone sees or does what isn’t theirs to see or do: another customer’s order, an admin route. Roles and BOLA in lesson 5; CSRFCSRF stands for Cross-Site Request Forgery.An attack in which a page makes your browser send a request to a site where you’re logged in, with your cookies, to do something on your behalf, such as changing your email or buying something. CORS doesn’t prevent it, because many requests reach the server even if the page can’t read the response.Go to definition and SSRFSSRF stands for Server-Side Request Forgery.An attack in which someone gives a server a URL to visit, and the server’s request reaches places only it can reach, like its own database, the internal network or the credentials the cloud gives it. It’s stopped by checking which IP address the URL points to before connecting.Go to definition in lesson 7
A02 Security Misconfiguration The code is fine, but the configuration isn’t: missing headers, sample accounts, cookies without HttpOnly. The cookie’s attributes in lesson 2; the sample secrets refused in lesson 8; this lesson’s headers
A03 Software Supply Chain Failures The flaw comes in with other people’s code: a package with a known flaw, or a poisoned one. The .npmrc from Phase 3; npm audit in this lesson
A04 Cryptographic Failures Data that travels or is stored without the protection it needs. TLSTLS stands for Transport Layer Security.The protocol that encrypts a connection and uses a certificate to prove the server is who it claims to be. It sits between TCP and HTTP, and HTTP over TLS is HTTPS.Go to definition in Phase 0; argon2id in lesson 1
A05 Injection A piece of data that the database or the browser ends up running as code. Parameters in Phase 5; SQL injectionSQL stands for Structured Query Language.An attack that sends a value crafted so that, pasted inside the text of a query, it changes what the query does, such as returning every row or deleting a table. It’s prevented by sending the values separately, as parameters, and never pasting them into the SQL.Go to definition and XSSXSS stands for Cross-Site Scripting.An attack in which a web page includes text someone else wrote, and that text carries JavaScript code that each visitor’s browser runs as if it were the page’s own. It’s prevented by replacing the special characters in each piece of data, like “<”, with a version the browser shows but never reads as code.Go to definition in lesson 6
A06 Insecure Design No single line fails: a defense nobody thought of is missing. The shared ADMIN_TOKEN from the introduction
A07 Authentication Failures The shop lets in someone who isn’t who they say: weak passwords, unlimited attempts, sessions that never expire. Lessons 1 to 4, and the limits in lesson 8
A08 Software or Data Integrity Failures Code or data is taken as good without checking that nobody has changed it. The hashes in the lockfile (Phase 3); the signature of the WebhookAn address on your server that another service sends a request to when something happens, such as a completed payment. Instead of you asking every so often whether something has changed, they let you know.Go to definition (Phase 4) and of the JWTJWT stands for JSON Web Token.A piece of text with some data in JSON, like who someone is and until when it’s valid, and a signature that proves who issued it and that nobody has changed it. It usually isn’t encrypted, so anyone who has it can read it, and it can’t be canceled before it expires without keeping a separate list.Go to definition (lesson 3)
A09 Security Logging and Alerting Failures An attack happens and nobody finds out: it isn’t in the LogA text file where a program writes down what happens, one line for each thing. A web server’s has a line for each request it receives, and it’s the first thing you look at when something fails.Go to definition, or nobody looks at it. The logs from Phase 3; this lesson
A10 Mishandling of Exceptional Conditions An unexpected error leaves the program in a strange state: it crashes, shows too much or lets someone through. The errors from Phase 3; the transactions from Phase 5

CSRF and SSRF don’t have a row of their own: they’re inside A01, because they’re requests made with someone else’s power, your session or the server’s network. Compared with 2021, A02 climbs from fifth place to second, A03 widens “vulnerable components” to the whole supply chain, and A10 is new.

In Phase 3 you saw the 2025 attacks on npm and the project’s .npmrc: a 7-day wait for every version, no commands run when installing, and exact versions. This site’s repository does something similar with pnpm, and on top of that Dependabot, a GitHub robot, proposes the new versions every week, with the same wait except for security fixes.

What’s still missing is knowing whether a version you already have has a known flaw: npm audit tells you that, in “Try it.”

Insecure design isn’t fixed by programming better. The ADMIN_TOKEN from the introduction didn’t have a single code flaw, and yet Ana, Luis and the delivery company shared one key. The defense is to look at the API the way an attacker would before programming it.

In the face of an error, fail closed: if something goes wrong, the answer is “no.”

  • Without a valid secret, the server doesn’t start (Phase 3), and since lesson 8, not with the one in .env.example either.
  • A 500 gives nothing away about the inside (Phase 3): an error that shows too much is part of A10.
  • A transaction that fails leaves nothing half-done (Phase 5).
  • With too many failures, the 429 comes before the password is even looked at (lesson 8).

OWASP has another list just for APIs, the API Security Top 10, from 2023:

Risk In the shop
API1 Broken Object Level Authorization BOLABOLA stands for Broken Object Level Authorization.The flaw in an API that lets you see or change someone else’s data, like an order or an invoice, just by changing its number in the URL. The API checks who you are, but not whether that data is yours. It’s very common: it tops OWASP’s list of API flaws.Go to definition: whose each order is (lesson 5)
API2 Broken Authentication Passwords, sessions, tokens and keys (lessons 1 to 4)
API3 Broken Object Property Level Authorization The sign-up ignores an extra role (in “Try it”)
API4 Unrestricted Resource Consumption Limits on attempts (lesson 8) and on page size (Phase 4)
API5 Broken Function Level Authorization Every route, with its requirePermission (lesson 5)
API6 Unrestricted Access to Sensitive Business Flows 5 sign-ups per IP per hour (lesson 8)
API7 Server Side Request Forgery The delivery notification URL, checked (lesson 7)
API8 Security Misconfiguration The headers and CORS (Phase 2)
API9 Improper Inventory Management /v1, deprecated, was closed just like /v2 (lesson 5)
API10 Unsafe Consumption of APIs The webhook’s signature and the provider’s id_token, checked

In Phase 3, the shop started writing one line per request. It still does, in src/middleware/request-log.ts:

src/middleware/request-log.ts
import type { MiddlewareHandler } from 'hono';
import { log } from '../log.ts';
// The same idea as in Phase 3, lesson 6, now with pino: each request, one JSON line with its id.
export const requestLog: MiddlewareHandler = async (c, next) => {
const start = performance.now();
await next();
log.info(
{
requestId: c.get('requestId'),
method: c.req.method,
path: c.req.path,
status: c.res.status,
ms: Math.round(performance.now() - start),
},
'request',
);
};
  • Neither the body nor the headers: the password, the cookie and Authorization never reach the log.
  • c.req.path is the path without the Query stringThe part of a URL that comes after “?”: data in name=value pairs separated by “&”, such as q=mug&sort=price. It travels to the server attached to the path, and it’s used to search, filter or choose a page of results.Go to definition: so the OAuth code, or a token someone puts in the URL, doesn’t get there either.
  • pino writes JSON: a line break inside a value stays in its text, and nobody can slip a fake line into the log.

A09 asks for more: record the security events (sign-ins, denied permissions, role changes) with what’s needed to investigate them. According to OWASP’s logging guide:

Recorded Never recorded
What happened (failed sign-in), when, and the request id The password, not even the wrong one
Which account (its id, or the email tried) The session id or the cookie
From which IP Tokens, API keys and the Authorization header
The result: 400, 403, 429 DATABASE_URL and any other SecretA piece of data that gives access to something and that only the people and programs that need it should know, like a database password or an API key. It’s never written inside the code.Go to definition

And A09 is called Logging and Alerting: a log nobody reads doesn’t warn anyone of anything. Alerts come in Phase 10.

The goal: review your shop the way the person filling in the questionnaire would. Its headers, its packages, a field it shouldn’t accept and what a failed sign-in leaves in the log.

You work with your project from lesson 8, “Rate limiting,” in ~/backend-course/phase-3/shop-api, with the API started with npm start. This lesson doesn’t change the code. The outputs are from Node 26.11.1, npm 11.20.0 and PostgreSQL 18; your ids, dates and times will be different.

To compare, start the shop from lesson 5, from before secureHeaders(), next to yours. If you already have the 28-roles folder, skip curl and tar:

Ventana de terminal
cd ~/backend-course/phase-3
curl -O https://backenddesdecero.com/practicas/shop-api/28-roles.tar.gz
tar -xzf 28-roles.tar.gz
cd 28-roles
npm ci
cp ../shop-api/.env .
PORT=3002 npm start

PORT=3002, in front of the command, wins over the .env: that way it doesn’t clash with your shop, which is still on 3000. In another terminal:

1. Before: the shop from lesson 5

Ventana de terminal
curl -sI localhost:3002/v2/products

What you will see:

HTTP/1.1 200 OK
content-type: application/json
vary: Origin
x-request-id: d6e57b82-ed29-4ca1-8052-dc548ddf08bc
Date: Wed, 14 Oct 2026 04:50:46 GMT
Connection: keep-alive
Keep-Alive: timeout=5

-I asks only for the headers, as in Phase 2. None of them is a security header. If you get Failed to connect, the shop from lesson 5 hasn’t started: look at its terminal.

2. After: your shop

Ventana de terminal
curl -sI localhost:3000/v2/products

What you will see:

HTTP/1.1 200 OK
content-type: application/json
cross-origin-opener-policy: same-origin
cross-origin-resource-policy: same-origin
origin-agent-cluster: ?1
referrer-policy: no-referrer
strict-transport-security: max-age=15552000; includeSubDomains
vary: Origin
x-content-type-options: nosniff
x-dns-prefetch-control: off
x-download-options: noopen
x-frame-options: SAMEORIGIN
x-permitted-cross-domain-policies: none
x-request-id: 973abba4-b3a4-4fa4-9e10-2b4b37026ed9
x-xss-protection: 0
Date: Wed, 14 Oct 2026 04:50:46 GMT
Connection: keep-alive
Keep-Alive: timeout=5

Eleven new headers, from a single line of src/app.ts (lesson 6). If they don’t show up, check that app.use(secureHeaders()) comes before the routes.

You already saw x-content-type-options: nosniff and referrer-policy in Phase 2, and x-xss-protection: 0 in lesson 6. Of the others, the ones that matter most:

Header What it asks the browser for
strict-transport-security To come in only over HTTPS for 180 days. Over http://localhost the browser ignores it: it will act once there’s HTTPS, in Phase 8
x-frame-options: SAMEORIGIN That another site doesn’t put your pages inside its own, with an invisible button on top
cross-origin-opener-policy and cross-origin-resource-policy To isolate your pages and responses from those of other sites

The rest adjust minor details. content-security-policy is missing on purpose: it goes only on /shop (lesson 6). Stop the shop from lesson 5 with Ctrl + C and go back to your project with cd ../shop-api.

npm audit: packages with known vulnerabilities

Section titled “npm audit: packages with known vulnerabilities”

npm audit compares the versions in the lockfile with a public database of known flaws, GitHub’s, and tells you which ones affect you.

3. Your packages’ warnings

Ventana de terminal
npm audit

What you will see:

# npm audit report
esbuild <=0.24.2
Severity: moderate
esbuild enables any website to send any requests to the development server and read the response - https://github.com/advisories/GHSA-67mh-4wv8-2f99
fix available via `npm audit fix --force`
Will install drizzle-kit@0.18.1, which is a breaking change
node_modules/@esbuild-kit/core-utils/node_modules/esbuild
@esbuild-kit/core-utils *
Depends on vulnerable versions of esbuild
node_modules/@esbuild-kit/core-utils
@esbuild-kit/esm-loader *
Depends on vulnerable versions of @esbuild-kit/core-utils
node_modules/@esbuild-kit/esm-loader
drizzle-kit 0.19.0 - 1.0.0-beta.1-fd8bfcc
Depends on vulnerable versions of @esbuild-kit/esm-loader
node_modules/drizzle-kit
4 moderate severity vulnerabilities
To address all issues (including breaking changes), run:
npm audit fix --force

It’s the warning you see when installing since lesson 9 of Phase 5. From top to bottom:

  • The package and the affected versions: esbuild, up to 0.24.2.
  • The severity: low, moderate, high or critical. This one is moderate.
  • The flaw: another site could read the responses of esbuild’s development server, which drizzle-kit doesn’t start.
  • The chain: it comes from drizzle-kit through two packages in between; the four count as four warnings.
  • The proposed fix: --force would install drizzle-kit 0.18.1, old and incompatible. Don’t run it: it trades a moderate warning for a broken project.

4. Only what the server uses

Ventana de terminal
npm audit --omit=dev

What you will see:

found 0 vulnerabilities

--omit=dev leaves out the devDependencies: drizzle-kit only generates migrations on your computer. The server has no known flaw.

So what now? Today, nothing: on October 14, 2026, the 0.31.11 you have is drizzle-kit’s latest stable version. The 1.0 versions, still in testing, no longer include that esbuild: the fix will arrive with the stable 1.0, after its 7-day wait. If one day a high or a critical shows up in a package the server uses, you update it to the version that fixes it; if that version is less than 7 days old, you skip the wait just for it, on purpose.

A development package isn’t harmless: when you use it, it runs on your computer with your permissions, exactly where Shai-Hulud went looking for keys. That’s why you read every warning: what flaw it is and whether it reaches you.

API3 says that a property that isn’t yours can’t be seen or changed. Can someone sign up as an admin from the start? You try it on your own shop, on localhost: trying something like this on a system that isn’t yours, without permission, is a crime.

5. A sign-up that asks to be admin

Ventana de terminal
curl -s -w '\n' --json '{"email":"jorge@example.com","password":"my bike is green and ten years old","role":"admin"}' localhost:3000/v2/accounts

What you will see:

{"id":7,"email":"jorge@example.com","role":"customer"}

Jorge is a customer. The new account’s schema only knows email and password, Zod drops the rest, and the role comes from the table’s DEFAULT 'customer'. If you get a 429, you’ve already created 5 accounts this hour: wait, or restart the shop.

6. A wrong password

Ventana de terminal
curl -s -w '\n' --json '{"email":"carmen@example.com","password":"not-mine"}' localhost:3000/v2/session

What you will see:

{"type":"https://shop.example/problems/invalid-credentials","title":"The email or the password is not correct","status":400,"detail":"Check both and try again"}

The 400 from lesson 2. Now look at the npm start terminal.

In the shop’s terminal there’s one more line (we’ve replaced the computer’s name with laptop):

{"level":30,"time":1791953453862,"pid":181,"hostname":"laptop","requestId":"a58cb479-3942-4e2f-8a65-00245a46eb58","method":"POST","path":"/v2/session","status":400,"ms":26,"msg":"request"}

No trace of not-mine: good. But no trace of the email or the IP either.

Challenge: with lines like that one, could you tell someone trying a thousand passwords on Carmen’s account apart from a thousand customers who each get it wrong once? What would you add to the line, and what never?Show answer

No: both leave a thousand identical lines. Lesson 8’s limiter counts by email and by IP, but in memory, without a trace.

An event line, with level warn, would add failed sign-in, the email tried and the IP. That way, “ten failures on one account” or “thirty from one IP” can become alerts. Never the password: a wrong one is often the right one with one letter changed, or the one from another site.

  • The “new sign-in to your account” email from Google or your bank: a security event recorded, and an alert to the only person who knows whether it was them.
  • npm’s warnings when installing. npm install runs npm audit on its own and shows the summary.
  • Treating the Top 10 as a certificate. “We comply with the OWASP Top 10” means nothing you can check; explaining how you cover each risk does.
  • Trusting a scanner. It finds missing headers and packages with flaws, but it doesn’t know that order 26 is Marta’s.
  • Running npm audit fix --force blindly. It can swap a package for an old or incompatible version.
  • Ignoring npm audit because “there are always warnings.”
  • Logging the body of every request “to debug.” The passwords go with it.
  • Logs without alerts: the attack is written down, and nobody reads it.
  • OWASP is an open community with a nonprofit foundation behind it; its Top 10 gathers the most serious risks for web applications, and it isn’t a certificate.
  • The Top 10:2025 goes from broken access control (A01) to mishandling errors (A10, new); you’ve already closed almost all of them.
  • APIs have their own Top 10 (2023), headed by BOLA.
  • secureHeaders() adds the security headers, and npm audit tells you which packages have known flaws; before fixing, look at the severity and whether they reach production.
  • A security log records what happened, to which account and from where; never passwords, sessions or tokens. And someone has to look at it.
The bookstore chain asks: “Does your API comply with the OWASP Top 10?” What does Ana answer?

In another shop, Carmen changes the number in her order’s URL and sees another customer’s. Under which risk of the Top 10:2025 do you file it?

npm audit warns of 4 moderate flaws in an old esbuild that comes with drizzle-kit, and proposes npm audit fix --force. npm audit --omit=dev says 0. What do you do?

A colleague wants to log the body of every failed sign-in, “to see what people type.” What do you tell them?

After adding secureHeaders(), curl -I shows strict-transport-security on http://localhost:3000. What does that header do on your computer?

In another API, the sign-up saves to the database all the JSON it receives. Someone sends role: admin. Which risk is it, and how is it closed?

phase-6 · lesson 9/9