OWASP Top 10 Explained with Practical Examples

Security2026-11-27TryQuickToolBox

You've deployed your web app, but are you sure it's secure? The OWASP Top 10 is the standard awareness document for web application security, listing the most critical risks. In this article, we'll walk through each risk with practical examples and show you how to fix them.

1. Broken Access Control

Access control enforces policy such that users cannot act outside of their intended permissions. Failures typically lead to unauthorized information disclosure, modification, or destruction of data.

Example: A user can access another user's account by changing the URL parameter:

GET /api/user/1234/profile

If there's no check that the authenticated user is 1234, this is a vertical privilege escalation.

Fix: Implement server-side checks. Use a middleware that verifies the user's role and ownership before processing the request.

2. Cryptographic Failures

Previously known as Sensitive Data Exposure, this risk arises when sensitive data is not properly protected, such as passwords stored in plain text or weak hashing.

Example: Storing passwords with MD5:

import hashlib
password_hash = hashlib.md5(password.encode()).hexdigest()

Fix: Use strong, salted hashing algorithms like bcrypt, Argon2, or PBKDF2.

3. Injection

Injection flaws, such as SQL, NoSQL, OS, and LDAP injection, occur when untrusted data is sent to an interpreter as part of a command or query.

Example: SQL injection via string concatenation:

query = "SELECT * FROM users WHERE username = '" + username + "'"

Fix: Use parameterized queries or prepared statements.

4. Insecure Design

Insecure design refers to missing or ineffective control design. It's not about implementation bugs but architectural flaws.

Example: A password recovery system that uses security questions, which can be easily guessed or researched.

Fix: Use threat modeling during design. Implement multi-factor authentication and rate limiting.

5. Security Misconfiguration

This is the most common issue, often resulting from default configurations, incomplete configurations, or verbose error messages.

Example: Leaving directory listing enabled on your web server, exposing sensitive files.

Fix: Harden your servers: disable directory listing, remove default accounts, and use security headers.

6. Vulnerable and Outdated Components

Using components with known vulnerabilities undermines your defenses.

Example: Using an old version of a library like jQuery with a known XSS vulnerability.

Fix: Regularly update dependencies. Use tools like OWASP Dependency-Check or npm audit.

7. Identification and Authentication Failures

Weaknesses in authentication and session management allow attackers to compromise passwords, keys, or session tokens.

Example: Allowing weak passwords like "123456" or not invalidating sessions after logout.

Fix: Enforce strong password policies, implement multi-factor authentication, and properly invalidate sessions.

8. Software and Data Integrity Failures

This risk relates to code and infrastructure that does not protect against integrity violations, such as using untrusted sources for updates.

Example: Downloading and executing a script from an unverified CDN.

Fix: Verify digital signatures, use Subresource Integrity (SRI) for CDN resources, and secure your CI/CD pipeline.

9. Security Logging and Monitoring Failures

Without proper logging and monitoring, breaches cannot be detected.

Example: Not logging failed login attempts, making brute force attacks undetectable.

Fix: Implement centralized logging, set up alerts for suspicious activities, and regularly review logs.

10. Server-Side Request Forgery (SSRF)

SSRF occurs when a web application fetches a remote resource without validating the user-supplied URL, allowing attackers to access internal services.

Example: A feature that fetches an image from a URL provided by the user, which could be used to scan internal networks.

Fix: Validate and sanitize URLs, use allowlists, and restrict network access from the server.

Comparison Table: Risk and Mitigation

RiskExampleMitigation
Broken Access ControlAccessing other users' data via URL manipulationServer-side authorization checks
Cryptographic FailuresStoring passwords with MD5Use bcrypt/Argon2 with salt
InjectionSQL injection via concatenationParameterized queries
Insecure DesignSecurity questions for password resetThreat modeling, MFA
Security MisconfigurationDirectory listing enabledHarden configurations
Vulnerable ComponentsOutdated jQueryRegular updates, dependency scanning
Authentication FailuresWeak passwords allowedStrong password policy, MFA
Integrity FailuresUnverified CDN scriptUse SRI, verify signatures
Logging FailuresNo logging of failed loginsCentralized logging, alerts
SSRFFetching internal URLsURL validation, allowlists

How to Prioritize Fixes

  1. Identify: Use automated scanners and manual code review to find vulnerabilities.
  2. Assess: Determine the risk based on likelihood and impact.
  3. Fix: Address the most critical issues first, such as injection and broken access control.
  4. Verify: Test the fixes and ensure they don't introduce new issues.
  5. Monitor: Continuously monitor for new vulnerabilities and attacks.

FAQ

What is the OWASP Top 10?

The OWASP Top 10 is a regularly updated list of the most critical security risks for web applications, published by the Open Web Application Security Project (OWASP).

How often is the OWASP Top 10 updated?

It is updated approximately every three to four years to reflect the changing threat landscape.

Is the OWASP Top 10 enough to secure my app?

No, it's a starting point. You should also follow secure coding practices, conduct regular security testing, and stay informed about emerging threats.

To further secure your applications, consider using tools like the JSON Formatter to safely inspect API responses, or explore other security-related resources on TryQuickToolBox.