OWASP Top 10 Explained with Practical Examples

Security2026-11-28TryQuickToolBox

You've built a web application, but are you sure it's secure? Every year, thousands of breaches exploit the same classes of vulnerabilities. The OWASP Top 10 is the industry-standard list of the most critical web application security risks. In this article, we'll break down each risk with practical examples and show you how to defend against 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  // Should only be accessible by user 1234

If the server doesn't verify that the logged-in user matches the requested ID, any user can view anyone's data.

Prevention: Implement access control checks on the server side, deny by default, and use role-based access control (RBAC).

2. Cryptographic Failures

Previously known as "Sensitive Data Exposure," this risk involves failing to protect sensitive data in transit or at rest.

Example: Storing passwords in plaintext or using weak hashing algorithms like MD5.

// Bad: MD5 is broken
$hashed = md5($password);
// Good: Use bcrypt or Argon2
$hashed = password_hash($password, PASSWORD_BCRYPT);

Prevention: Encrypt sensitive data at rest and in transit (HTTPS), use strong hashing algorithms, and avoid storing unnecessary data.

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:

// Vulnerable
$sql = "SELECT * FROM users WHERE username = '" . $_GET['username'] . "'";
// Attacker sends: ' OR '1'='1

Prevention: Use parameterized queries or prepared statements.

$stmt = $pdo->prepare('SELECT * FROM users WHERE username = ?');
$stmt->execute([$_GET['username']]);

4. Insecure Design

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

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

Prevention: Use threat modeling, secure design patterns, and reference architectures. Incorporate security requirements early in development.

5. Security Misconfiguration

This is the most common issue. It includes unpatched flaws, default configurations, unnecessary features enabled, and missing security headers.

Example: Leaving directory listing enabled on an Apache server or using default admin credentials.

Prevention: Harden your stack, remove unused features, and use automated tools to check for misconfigurations. Always change default passwords.

6. Vulnerable and Outdated Components

Using components with known vulnerabilities undermines your application's defenses.

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

Prevention: Regularly update dependencies, use tools like npm audit or OWASP Dependency-Check, and remove unused dependencies.

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 implementing account lockout after failed login attempts.

Prevention: Enforce strong password policies, implement multi-factor authentication (MFA), and use secure session management.

8. Software and Data Integrity Failures

This risk relates to code and infrastructure that does not protect against integrity violations.

Example: Downloading and running software from untrusted sources without verifying checksums, or using insecure deserialization.

Prevention: Verify the integrity of downloaded software, use digital signatures, and avoid insecure deserialization.

9. Security Logging and Monitoring Failures

Insufficient logging and monitoring, coupled with missing or ineffective integration with incident response, allows attackers to further attack systems.

Example: Not logging failed login attempts, so a brute-force attack goes unnoticed.

Prevention: Log all authentication and access control events, monitor logs for suspicious activity, and have an incident response plan. Tools like the Nginx Log Analyzer can help you parse and analyze server logs to detect anomalies.

10. Server-Side Request Forgery (SSRF)

SSRF flaws occur when a web application fetches a remote resource without validating the user-supplied URL.

Example: A webhook feature that allows users to specify a URL, which the server then requests. An attacker could supply http://localhost:8080/admin to access internal services.

Prevention: Validate and sanitize URLs, use allowlists, and enforce network segmentation.

Comparison Table: OWASP Top 10 at a Glance

RiskExamplePrevention
Broken Access ControlAccessing other users' data via URL manipulationServer-side access checks, deny by default
Cryptographic FailuresStoring passwords in plaintextUse strong hashing (bcrypt, Argon2)
InjectionSQL injection via string concatenationParameterized queries
Insecure DesignGuessable security questionsThreat modeling, secure design patterns
Security MisconfigurationDefault admin credentialsHarden configurations, remove defaults
Vulnerable ComponentsOutdated jQuery with XSS flawRegular updates, dependency scanning
Authentication FailuresWeak password policyMFA, strong password policies
Integrity FailuresInsecure deserializationVerify integrity, avoid deserialization
Logging FailuresNo logs for failed loginsCentralized logging, monitoring
SSRFFetching internal URLs via user inputURL 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: Start with critical and high-risk issues, especially those exposed to the internet.
  4. Verify: Retest to ensure fixes are effective.
  5. Monitor: Continuously monitor for new vulnerabilities and anomalous behavior.

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 changes in the threat landscape. The latest version is from 2021.

Is the OWASP Top 10 enough to secure my application?

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

Ready to strengthen your security posture? Start by analyzing your server logs for suspicious activity with our Nginx Log Analyzer. It helps you identify potential attacks and misconfigurations quickly.