Skip to content

Intermediate · Backend security · topic 36 of 54 · 25 min

The OWASP Top 10: the most common web risks

Explanation

OWASP is a free, open community that helps people build safer software. Its best-known project is the Top 10: a short list of the most common and serious risks in web apps, such as broken access control and injection. Backend developers use it as a checklist when they build and review an app.

What OWASP is

OWASP stands for Open Worldwide Application Security Project. It is a non-profit community of security people from many countries. Everything it makes is free: guides, cheat sheets, testing tools and lists.

A vulnerability is a weakness in an app that an attacker can use to do something they should not, like read other people's data. The OWASP Top 10 lists the ten kinds of vulnerability that are found most often and do the most damage in real web apps.

The list is built from data collected from many companies and security testers. It is updated every few years, and names and order can change between editions. Newer editions may merge or rename items, for example giving more weight to the software supply chain (the packages and tools your app is built from). Always check the official OWASP page for the latest edition.

Think of it like this: Think of the checklist a pilot reads before take-off. The pilot is skilled, but the list makes sure nothing common is forgotten. The OWASP Top 10 is that checklist for a web app: it does not cover every possible problem, but it catches the mistakes that cause most break-ins.

The ten risks in simple words

RiskSimple meaningOne fix
Broken access controlA user can see or change things that belong to someone else, like another person's orderCheck on the server, on every request, that this user owns or may use this record
Cryptographic failuresSensitive data is not protected well: plain-text passwords, no HTTPS, weak old algorithmsUse HTTPS everywhere, hash passwords with bcrypt or Argon2, encrypt sensitive fields
InjectionUser input is treated as code, for example inside an SQL query or a shell commandUse parameterised queries and never build commands by joining strings
Insecure designThe plan itself is unsafe, like an OTP with no limit on triesThink about abuse while designing: limits, approvals, safe defaults
Security misconfigurationWrong settings: debug mode on in production, default passwords, open storage bucketsUse a hardened, repeatable setup and review settings before each release
Vulnerable and outdated componentsOld libraries or servers with known bugsKeep dependencies updated and run npm audit or a dependency scanner
Identification and authentication failuresWeak login: no limit on password guesses, sessions that never endRate-limit logins, use strong session handling, offer two-factor login
Software and data integrity failuresCode or data is trusted without checking it was not changed, like unsigned updatesUse lock files, trusted package sources and signed builds
Security logging and monitoring failuresAttacks happen but nobody noticesLog logins, failures and admin actions, and set alerts
Server-side request forgery (SSRF)The server is tricked into fetching a URL the attacker chooses, even internal onesAllow only known hosts and block internal addresses

Number one in practice: access control

Access control means deciding who may do what. A very common bug: the URL /api/orders/1005 shows order 1005 to anyone who is logged in, even if it belongs to someone else. The fix is one extra check on the server.

javascript
app.get('/api/orders/:id', requireLogin, async (req, res) => {
  const order = await db.getOrder(req.params.id);
  // The important line: is this order really yours?
  if (!order || order.userId !== req.user.id) {
    return res.status(404).json({ error: 'Not found' });
  }
  res.json(order);
});
Checking ownership on every request (runs on a server with Node.js and Express).

Some fixes are just HTTP headers. A header is a small line of extra information sent with every response. Security headers tell the browser to be stricter, for example to use only HTTPS or to refuse scripts from unknown places.

javascript
app.use((req, res, next) => {
  res.set('Strict-Transport-Security', 'max-age=31536000; includeSubDomains');
  res.set('X-Content-Type-Options', 'nosniff');
  res.set('Content-Security-Policy', "default-src 'self'");
  next();
});
Middleware that adds three common security headers (runs on a server with Node.js and Express). The helmet package can add these for you.
Tip: Use the Top 10 during code review. For each new feature ask: who may use it (access control), what input reaches a query (injection), what is logged, and which packages it adds.
Careful: Hiding a button in the app is not access control. Attackers do not use your app; they send requests straight to your API. Every rule must be checked on the server.

OWASP also publishes free Cheat Sheets: short, practical guides on topics like password storage, sessions and input validation. They are a good next step after this module.

Watch the lesson

The OWASP Top 10: the most common web risks · 1/7

Same mistakes, again and again

Attackers do not invent new tricks every day. Most break-ins use the same few mistakes again and again.

Prefer a video by a teacher? Find free videos on “owasp top 10 explained for beginners” on YouTube ↗

In real life: A college results site

A college puts exam results online at /results?roll=R101. A student notices that changing the roll number shows any student's marks and phone number, without a login check: broken access control. The search box also puts the roll number straight into an SQL query: injection. The server runs a framework version from four years ago with a known bug: outdated components. And nobody noticed thousands of requests in one night: logging and monitoring failure. One app, four items from the Top 10. A review against the list before launch would have caught all of them.

Practice (0/3 done)

Task 1 · Code · Javascript

A tester writes short bug reports. Write classify(description) that returns the category of the FIRST rule in RULES that has a keyword appearing in the description. Ignore upper/lower case. If no keyword matches, return "Needs review".

Task 2 · Code · Javascript

Write missingSecurityHeaders(headers). headers is an object of response headers (names can be in any case). Return an array of the REQUIRED header names (in lower case, in the same order as REQUIRED) that are missing.

Task 3 · Practice

Pick a small app you know or have built (a kirana billing app, a notes app, a college fest registration site). Review it against the Top 10 and write down the three risks most likely to affect it, with one fix for each.

Quick quiz

Question 1

1.What is the OWASP Top 10?

Question 2

2.A logged-in user changes /api/orders/1005 to /api/orders/1006 and sees a stranger's order. Which risk is this?

Question 3

3.Your app still uses a library version with a publicly known security bug. Which category fits?

Question 4

4.Why should you check the official OWASP page for the Top 10?

Question 5

5.Hiding the "Delete user" button from normal users is enough to protect the delete API. True?

Read more (free)

Pass the quiz (60% or more) or mark this topic as done when you are ready.

Your progress is saved on this device only.

← Previous: Authorization: who can do what