Intermediate · Backend security · topic 36 of 54 · 25 min
The OWASP Top 10: the most common web risks
Explanation
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.
The ten risks in simple words
| Risk | Simple meaning | One fix |
|---|---|---|
| Broken access control | A user can see or change things that belong to someone else, like another person's order | Check on the server, on every request, that this user owns or may use this record |
| Cryptographic failures | Sensitive data is not protected well: plain-text passwords, no HTTPS, weak old algorithms | Use HTTPS everywhere, hash passwords with bcrypt or Argon2, encrypt sensitive fields |
| Injection | User input is treated as code, for example inside an SQL query or a shell command | Use parameterised queries and never build commands by joining strings |
| Insecure design | The plan itself is unsafe, like an OTP with no limit on tries | Think about abuse while designing: limits, approvals, safe defaults |
| Security misconfiguration | Wrong settings: debug mode on in production, default passwords, open storage buckets | Use a hardened, repeatable setup and review settings before each release |
| Vulnerable and outdated components | Old libraries or servers with known bugs | Keep dependencies updated and run npm audit or a dependency scanner |
| Identification and authentication failures | Weak login: no limit on password guesses, sessions that never end | Rate-limit logins, use strong session handling, offer two-factor login |
| Software and data integrity failures | Code or data is trusted without checking it was not changed, like unsigned updates | Use lock files, trusted package sources and signed builds |
| Security logging and monitoring failures | Attacks happen but nobody notices | Log 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 ones | Allow 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.
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);
});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.
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();
});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
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)
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".
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.
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
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.