OWASP Top 10:2025 and Secure Coding for Developers
Recognise the ten OWASP Top 10:2025 risks in real code and apply the secure coding habits that prevent them: access checks, parameterised queries, safe secrets, patched dependencies and fail-closed errors.
What you will learn
- Explain what the OWASP Top 10:2025 is, what changed since 2021, and how it fits into a secure development lifecycle.
- Prevent broken access control, including IDOR and server-side request forgery, with deny-by-default server-side checks.
- Stop injection flaws such as SQL injection, cross-site scripting and command injection with parameterised queries and output encoding.
- Implement sound authentication, session handling and cryptography: password hashing, MFA, TLS and key management.
- Harden configuration and design: secure defaults, security headers, secrets out of code and simple threat modelling.
- Manage the software supply chain and integrity: dependency updates, SBOM, lockfiles, signed builds and safe deserialisation.
- Log and alert on security events without leaking data, and handle errors and exceptional conditions so the application fails closed.
Modules
- The OWASP Top 10:2025 at a glance
- A01 Broken Access Control
- A05 Injection: SQL, commands and XSS
- A07 Authentication and A04 Cryptographic Failures
- A02 Security Misconfiguration and A06 Insecure Design
- A03 Supply Chain and A08 Integrity Failures
- A09 Logging and Alerting, A10 Exceptional Conditions
Course facts
- Level
- Awareness
- Estimated study time
- about 45 minutes
- Final assessment
- 26 questions · Pass mark 80%
- Available in
- English, Français, العربية
- Price
- Free. Optional verifiable certificate: $5
- Last updated
- Published by
- AMAADOR ACADEMY
Who this course is for
Web, mobile and API developers, junior to mid-level, plus testers, tech leads and DevOps engineers who write or review application code.
Prerequisites
Basic programming experience in any language and a general idea of how a web application talks to a database and a browser.
Course content
1. The OWASP Top 10:2025 at a glance
The OWASP Top 10 is an awareness document published by the OWASP Foundation, a non-profit open community. It lists the ten most critical categories of web application security risk. The 2025 edition is the eighth. OWASP built it from testing data on more than 2.8 million applications, CVE data from the US National Vulnerability Database and a community survey that chose two of the ten categories.
| Rank | Category (2025) | Change since 2021 |
|---|---|---|
| A01 | Broken Access Control | Still #1; now includes SSRF |
| A02 | Security Misconfiguration | Up from #5 |
| A03 | Software Supply Chain Failures | Expands “Vulnerable and Outdated Components” |
| A04 | Cryptographic Failures | Down from #2 |
| A05 | Injection | Down from #3 (includes XSS) |
| A06 | Insecure Design | Down from #4 |
| A07 | Authentication Failures | Renamed |
| A08 | Software or Data Integrity Failures | Same rank |
| A09 | Security Logging and Alerting Failures | Renamed (“Monitoring” became “Alerting”) |
| A10 | Mishandling of Exceptional Conditions | New |
Each category groups many CWE weaknesses (CWE is MITRE’s catalogue of software weakness types). OWASP says 248 CWEs fall inside the ten 2025 categories. So “Injection” is not one bug but a family: SQL injection, cross-site scripting, OS command injection and more.
2. A01 Broken Access Control
Authentication answers “who are you?”. Access control (authorisation) answers “are you allowed to do this, to this object, right now?”. Broken access control means a user can act outside their intended permissions: read another customer’s data, change a price, or reach an admin page. It is A01 in both 2021 and 2025.
The classic example is the IDOR (insecure direct object reference). The URL /api/invoices/1043 returns invoice 1043. A logged-in user changes it to 1044 and receives someone else’s invoice, because the code only checked that the user was logged in, not that the invoice belongs to them.
Do
- Deny by default: every route needs an explicit rule
- Check ownership in the query itself: WHERE id = ? AND owner_id = ?
- Enforce rules in one central place (middleware, policy layer)
- Write tests that log in as user B and try user A’s objects
- Rate-limit and log access-control failures
Don't
- Hide the admin button and assume nobody finds the URL
- Trust a role or user ID sent by the client (cookie, hidden field, JWT claim you did not verify)
- Rely on unguessable IDs as the only protection
- Copy-paste checks into each controller and forget one
3. A05 Injection: SQL, commands and XSS
Injection happens when untrusted data is mixed into a command or query and the interpreter treats part of it as code. The interpreter can be a SQL database, an operating system shell, an LDAP directory, a template engine or a NoSQL query.
Vulnerable pattern: the code builds the query by joining strings, such as "SELECT * FROM users WHERE email = '" + email + "'". If someone types ' OR '1'='1 as the email, the query now returns every user. Worse inputs can read other tables or change data.
- Use parameterised queries (prepared statements) — WHERE email = ? with the value bound separately. The database never treats the value as SQL.
- Use the ORM properly — query builders are safe until someone passes raw strings; review every “raw” or “unsafe” call.
- Validate input with an allow-list — type, length, format. Validation reduces risk but does not replace parameters.
- Never build shell commands from input — call the library or API directly; if a process is unavoidable, pass arguments as an array, never through a shell string.
- Least privilege for the database account — the web app user should not own the schema or be able to drop tables.
4. A07 Authentication and A04 Cryptographic Failures
A07:2025 Authentication Failures covers weaknesses that let an attacker pretend to be someone else: weak password rules, no protection against credential stuffing (trying passwords leaked from other sites), broken “forgot password” flows and sessions that never expire.
| Topic | Weak practice | Good practice |
|---|---|---|
| Password storage | Plain text, MD5, SHA-1, unsalted SHA-256 | A slow, salted password hash: Argon2id first choice per OWASP, or scrypt, bcrypt, PBKDF2 |
| Password rules | Forced monthly change, complex symbol rules | Long passphrases, check against known-breached lists (NIST SP 800-63B) |
| Brute force | Unlimited attempts | Rate limiting, progressive delays, alerting |
| Second factor | None for admins | MFA, ideally phishing-resistant (passkeys/FIDO2) |
| Error messages | “Unknown email” vs “wrong password” | One generic message for both |
| Password reset | Security questions, reusable links | Single-use, short-lived random token sent to the verified address |
Sessions are as important as the login itself. After a successful login, issue a new session ID (this prevents session fixation). Mark the cookie Secure, HttpOnly and SameSite. Expire sessions after inactivity and invalidate them on the server at logout and after a password change. If you use JWTs, verify the signature and the algorithm on every request, check expiry, and never accept alg: none.
5. A02 Security Misconfiguration and A06 Insecure Design
A02:2025 Security Misconfiguration climbed from fifth to second place. Modern applications are assembled from frameworks, containers, cloud services and feature flags, and every one of them has settings that can be wrong. A perfectly coded application can still be exposed by one switch.
Do
- Automate configuration (infrastructure as code) so every environment is built the same way and reviewed
- Turn off debug mode, sample apps, default accounts and unused features in production
- Keep cloud storage buckets private by default and review access policies
- Return generic error pages; keep stack traces in the logs
- Send security headers and test them on every release
- Keep secrets in a vault or the platform’s secret store, injected at run time
Don't
- Commit API keys, passwords or private keys to Git, even in a private repository
- Leave admin consoles, database ports or monitoring dashboards open to the internet
- Use Access-Control-Allow-Origin: * on an API that uses cookies or tokens
- Ship directory listing or a “.git” folder on the web server
| Header | Purpose |
|---|---|
| Content-Security-Policy | Limits where scripts and other resources may load from; second line against XSS |
| Strict-Transport-Security | Forces HTTPS for the domain |
| X-Content-Type-Options: nosniff | Stops the browser guessing file types |
| frame-ancestors (in CSP) or X-Frame-Options | Prevents clickjacking by blocking framing |
| Referrer-Policy | Limits URL data sent to other sites |
6. A03 Supply Chain and A08 Integrity Failures
Most of a typical application is code you did not write: open-source packages, their own dependencies, base container images, build plugins. A03:2025 Software Supply Chain Failures widens the old “Vulnerable and Outdated Components” category to cover the whole chain, from the package registry to your build server.
Case: in December 2021, CISA issued emergency guidance on Log4Shell (CVE-2021-44228), a flaw in the Apache Log4j Java logging library that let an unauthenticated attacker run code remotely with one crafted request. Versions 2.0-beta9 to 2.14.1 were affected, and CISA told organisations to upgrade to fixed releases such as 2.17.1 · the library was buried deep in thousands of products, so many teams did not know they used it · an up-to-date inventory of components (SBOM) and fast patching made the difference.
Case: the US Federal Trade Commission states that the 2017 Equifax breach exposed the personal information of 147 million people after Equifax failed to patch a critical vulnerability it had been alerted to in March 2017. The 2019 settlement was worth at least $575 million and up to $700 million · a known, patchable flaw left open for months · a tracked patching process with deadlines would have closed it.
7. A09 Logging and Alerting, A10 Exceptional Conditions
A09:2025 Security Logging and Alerting Failures was renamed from “Logging and Monitoring”. The new word is a hint: a log nobody looks at does not stop an attack. Without the right events and alerts, a breach can run for months before someone notices, often a customer or a journalist.
| Log these events | Never log these |
|---|---|
| Logins, failed logins, MFA changes, password resets | Passwords, even wrong ones |
| Access-control denials (403s) and input validation failures | Session IDs, access tokens, API keys |
| Admin actions and permission changes | Full card numbers or CVV |
| High-value business actions (payouts, exports, refunds) | Health data or ID numbers unless masked and justified |
| Errors and exceptions with a correlation ID | Encryption keys and secrets from configuration |
Each security event should answer who, what, when, where and outcome: user or service ID, action, UTC timestamp, source IP and endpoint, success or failure. Use a structured format (JSON) so tools can search it.
- Protect the logs: send them to a central store the application cannot edit or delete.
- Prevent log injection: encode or strip line breaks in user input so an attacker cannot forge fake log lines.
- Alert on patterns: many failed logins across accounts from one source, repeated 403s on IDs in sequence, a sudden spike in exports.
- Test the alert: trigger it in staging and check that a person actually receives it and knows what to do.
- Respect privacy law: logs with personal data fall under the GDPR or Law 09-08; keep them only as long as needed.
The full lesson continues in the interactive course on this page.
Sources and references
- OWASP Top 10:2025
- Application Security Verification Standard (ASVS) 5.0
- OWASP Cheat Sheet Series
- SP 800-218 Secure Software Development Framework (SSDF)
- Advisory AA23-158A: CL0P exploits MOVEit Transfer SQL injection (CVE-2023-34362)
- Apache Log4j vulnerability guidance (CVE-2021-44228)
- Equifax to pay $575 million as part of settlement with FTC, CFPB and states related to 2017 data breach
Educational course. Not affiliated with, endorsed by or sponsored by the OWASP Foundation; OWASP is a trademark of its owner. It does not replace your organisation's security policy, a professional code review or a penetration test. Only test systems you own or are explicitly authorised in writing to test.
All courses · Cybersecurity and IT — Free courses, certificate $5 | AMAADOR ACADEMY