OWASP Top 10 2021 Reference
OWASP (the Open Web Application Security Project) is a non-profit community that publishes free security guidance and tools. Its Top 10 ranks the most critical risk categories for web applications; each entry is a category of weaknesses, not a single bug. This is the 2021 edition, in my own words, with what to check in a Django or FastAPI app.
Overview
| # | Category | In short | What I check |
|---|---|---|---|
| A01 | Broken Access Control | users act beyond their permissions: other users' records, admin functions | every view checks ownership or permission, not only login; IDs in URLs are verified |
| A02 | Cryptographic Failures | sensitive data exposed in transit or at rest, or protected with weak crypto | HTTPS everywhere, no unneeded sensitive data stored, standard algorithms and libraries only |
| A03 | Injection | input treated as code: SQL, shell, template, and XSS (now in this category) | ORM or parameterised queries, no shell=True with input, auto-escaping left on |
| A04 | Insecure Design | flaws in the design that no implementation fixes | threat modelling, rate limits, business rules that can't be bypassed |
| A05 | Security Misconfiguration | unsafe defaults, verbose errors, open admin tools | DEBUG = False, secure headers, admin interfaces not public |
| A06 | Vulnerable and Outdated Components | known-vulnerable libraries, images or runtimes | pinned versions, dependency scanning, regular updates |
| A07 | Identification and Authentication Failures | weak login, session or password handling | rate-limited login, MFA where possible, secure session cookies |
| A08 | Software and Data Integrity Failures | code or data trusted without verification: unsigned updates, unsafe deserialisation, CI pipelines | signed artefacts, no pickle of untrusted data, protected pipelines |
| A09 | Security Logging and Monitoring Failures | attacks go unnoticed | log authentication and access failures, alert on them, keep logs off the box |
| A10 | Server-Side Request Forgery (SSRF) | the server fetches a URL an attacker chose, reaching internal services | allowlist outbound destinations, block metadata and private ranges |
Details
Access Control Fails on the Unhappy Path
Tests usually follow the intended path: the right user opens their own record. Broken access control lives on the paths nobody tested: changing an ID in the URL, calling an admin endpoint directly, sending a PUT where only GET was expected. Deny by default and check permissions on every request, server-side.
Cryptography Starts with Not Storing the Data
- Don't store sensitive data you don't need.
- Encrypt what you keep, in transit and at rest.
- Use well-known algorithms through maintained libraries; never invent a scheme.
Insecure Design Is Not a Coding Bug
Most categories are implementation mistakes; insecure design is a missing control in the design itself: a password reset that relies on guessable questions, a public form with no limit on submissions. Fixing the code that implements a flawed design leaves the flaw.
Related Terms
- SIEM (security information and event management): collects and correlates logs from many systems to detect attacks, the tooling behind A09.
- EDR (endpoint detection and response): an agent on each machine that watches process and system events against detection rules.
References
- OWASP Top 10:2021 - the categories with descriptions and mappings.
- OWASP Cheat Sheet Series - prevention guidance per topic.
- Web Application and Django Security MOC - hub for web security notes.
- CSRF Works Because Browsers Attach Cookies to Requests Other Sites Trigger - an example of a defence Django enables by default.
Review cards
Flashcard Why is it important to deny by default and check permissions on every request in a Django or FastAPI app?
To ensure that even if an attacker manages to change an ID in the URL or call an admin endpoint directly, their actions will be restricted by the application's permission checks.
Flashcard What is the main advice given for handling sensitive data in A02 Cryptographic Failures?
Do not store sensitive data if it is not necessary, encrypt data both in transit and at rest, and use well-known and maintained cryptographic algorithms and libraries.
Flashcard How does Insecure Design (A04) differ from other categories in the OWASP Top 10?
Insecure Design refers to flaws in the overall design of the application that cannot be fixed by simply changing the implementation code.