The OWASP Top 10 Explained

intermediate
12 min

The OWASP Top 10 Explained

The Open Worldwide Application Security Project (OWASP) periodically publishes the Top 10, a consensus ranking of the most critical web application security risks based on real-world breach and testing data. It is the closest thing web security has to a shared curriculum, and auditors, clients and job interviews all assume you know it. This lesson walks through the categories from the 2021 edition, which remains the reference list, with the mindset and defenses behind each.

A01: Broken Access Control

The number one risk. Authentication asks 'who are you?'; access control asks 'are you allowed to do this?'. Failures include insecure direct object references (changing /orders/1001 to /orders/1002 and seeing someone else's order), missing function-level checks on admin endpoints, and privilege escalation. Defense: deny by default, enforce checks server-side on every request, and write tests that verify user A cannot touch user B's data.

javascript
// Access control: verify ownership on every request app.get('/orders/:id', requireAuth, async (req, res) => { const order = await db.orders.findById(req.params.id); if (!order || order.userId !== req.user.id) { return res.status(404).json({ error: 'Not found' }); // don't reveal existence } res.json(order); });

A02: Cryptographic Failures

Sensitive data stored or transmitted without proper protection: plaintext passwords, deprecated algorithms, missing HTTPS, hardcoded keys. Defense: classify your data, encrypt in transit and at rest, hash passwords with bcrypt or Argon2, and use vetted libraries with modern defaults.

A03: Injection

SQL, NoSQL, OS command and LDAP injection, plus XSS in this edition. One cause: untrusted input interpreted as code. Defense: parameterized queries, output encoding, and never passing user input to shells or eval. Lessons 6 and 7 covered these in depth.

A04: Insecure Design

Flaws baked into the architecture itself, such as a password recovery flow based on guessable questions. Defense: threat modeling before coding, abuse-case thinking ('how would I cheat this feature?'), and security requirements treated like functional ones.

A05: Security Misconfiguration

Default credentials, directory listings, verbose stack traces in production, unnecessary features enabled, missing security headers. Defense: hardened, repeatable configuration through infrastructure as code, minimal installs, and automated configuration scanning.

A06: Vulnerable and Outdated Components

Your app inherits every vulnerability in its dependency tree. Defense: keep an inventory (SBOM), run npm audit, Dependabot or similar continuously, patch promptly, and remove unused dependencies.

A07: Identification and Authentication Failures

Weak passwords allowed, missing MFA, broken session management, credential stuffing not mitigated. Defense: everything from Lesson 3, plus secure session handling and login rate limiting.

A08: Software and Data Integrity Failures

Trusting updates, plugins or CI/CD artifacts without verifying integrity; insecure deserialization sits here too. Defense: signed packages, locked dependency versions with integrity hashes, protected build pipelines, and never deserializing untrusted data with unsafe formats.

A09: Security Logging and Monitoring Failures

Breaches routinely go undetected for months because nothing was watching. Defense: log logins, failures and privilege changes with timestamps and identities; centralize logs; alert on anomalies; rehearse how you would detect a breach.

A10: Server-Side Request Forgery (SSRF)

The server is tricked into fetching a URL supplied by the attacker, potentially reaching internal services or cloud metadata endpoints that outsiders cannot. Defense: allowlist permitted destinations, block private IP ranges for user-supplied URLs, and isolate fetching services with minimal network access.

Using the Top 10 Well

The list is a floor, not a ceiling: passing all ten categories does not make an app secure, but failing any of them makes it insecure. Use it to structure code reviews, as a checklist in design discussions, and as a shared vocabulary with security teams.

Key Takeaways

  • The OWASP Top 10 ranks real-world web risks; broken access control currently leads.
  • Most categories reduce to a few habits: deny by default, validate and encode, patch dependencies, log and monitor.
  • Server-side checks on every request are non-negotiable; client-side checks are UX, not security.
  • Treat the list as a minimum bar and a shared language.

Next lesson: Secure Coding Practices for Developers, turning these risk categories into daily habits.

The OWASP Top 10 Explained - Cyber Security | CodeYourCraft | CodeYourCraft