Denis Kirevby Denis Kirev

OWASP Top 10: Understanding Web Security Risks

Deep dive into the OWASP Top 10 web application security risks and how to mitigate them.

5 min read
SECURITYWEBGUIDE
Image

Introduction

The OWASP Top 10 is a standard awareness document for developers and security professionals, highlighting the most critical security risks in web applications. Understanding these vulnerabilities is essential for building secure applications and protecting sensitive data.

This article covers the OWASP Top 10 vulnerabilities, how they work, examples, and best practices to mitigate them.


OWASP Top 10 Evolution: 2017 vs. 2021

Below is a comparison of the OWASP Top 10 vulnerabilities from 2017 to 2021, showcasing the changes and newly introduced risks:

OWASP Top 10 Evolution

The key changes include:

  • Injection attacks remain a critical threat but have been categorized under A03:2021 - Injection.
  • Broken Authentication has been expanded into A07:2021 - Identification and Authentication Failures.
  • Cryptographic Failures replace Sensitive Data Exposure, emphasizing the importance of encryption and data protection.
  • Insecure Design (A04:2021) is a new category focusing on the root causes of security weaknesses.
  • Server-Side Request Forgery (SSRF) has been newly added due to its increasing impact.

1. Broken Access Control (A01:2021)

Overview

Broken Access Control occurs when users can perform actions outside their intended permissions, such as accessing unauthorized data or modifying admin-level configurations.

Example

A normal user is able to access an admin-only endpoint by modifying the URL:

https://example.com/admin/dashboard

Mitigation

  • Implement role-based access control (RBAC).
  • Enforce server-side authorization for each request.
  • Use least privilege principles for user roles.

2. Cryptographic Failures (A02:2021)

Overview

Sensitive data exposure happens when an application does not properly protect data, leading to unauthorized access or leaks.

Example

  • Storing passwords in plaintext instead of hashing them.
  • Exposing API keys or credentials in frontend JavaScript files.

Mitigation

  • Use strong encryption algorithms (AES-256 for data at rest, TLS 1.2+ for data in transit).
  • Never store sensitive data in local storage or cookies.
  • Implement secure password hashing (Argon2, PBKDF2, bcrypt).

3. Injection (A03:2021)

Overview

Injection attacks occur when untrusted data is sent to an interpreter (SQL, NoSQL, OS commands, etc.), leading to unauthorized command execution.

Example

SELECT * FROM users WHERE username = 'admin' OR '1'='1';

Mitigation

  • Use prepared statements and parameterized queries.
  • Implement input validation.
  • Use an ORM (Object-Relational Mapper) to avoid direct database queries.

4. Insecure Design (A04:2021)

Overview

Insecure design focuses on weaknesses in the application architecture that lead to security risks.

Example

  • Not implementing multi-factor authentication (MFA) for admin users.
  • Allowing unlimited login attempts without rate limiting.

Mitigation

  • Conduct threat modeling and security design reviews.
  • Use secure development life cycle (SDLC) practices.
  • Apply principle of least privilege from the design phase.

5. Security Misconfiguration (A05:2021)

Overview

Security misconfiguration happens when applications, servers, or databases have default settings, unnecessary features enabled, or incorrect security policies.

Example

  • Using default admin credentials (e.g., admin:admin).
  • Exposing stack traces and debug information in production.

Mitigation

  • Disable debug mode in production.
  • Regularly update software and dependencies.
  • Apply security headers (CSP, HSTS, X-Frame-Options).

6. Vulnerable and Outdated Components (A06:2021)

Overview

Using outdated libraries, frameworks, or software can introduce known vulnerabilities.

Example

  • Running an old version of jQuery with known XSS vulnerabilities.
  • Using a framework version with known security issues.

Mitigation

  • Keep all dependencies updated.
  • Regularly monitor for CVE (Common Vulnerabilities and Exposures).
  • Use SCA (Software Composition Analysis) tools.

7. Identification and Authentication Failures (A07:2021)

Overview

Improper authentication mechanisms allow attackers to impersonate users or bypass login protections.

Example

  • Weak password policies allowing short or common passwords.
  • Not implementing session timeouts or MFA.

Mitigation

  • Use strong authentication mechanisms (OAuth, OpenID Connect).
  • Implement multi-factor authentication (MFA).
  • Use secure session management practices.

8. Software and Data Integrity Failures (A08:2021)

Overview

This vulnerability includes insecure deserialization, dependency confusion, and software supply chain attacks.

Example

  • A package manager downloads an outdated or malicious dependency.
  • Unvalidated data is deserialized, leading to RCE (Remote Code Execution).

Mitigation

  • Use digital signatures for software integrity.
  • Validate all third-party dependencies.
  • Implement code integrity checks.

9. Security Logging and Monitoring Failures (A09:2021)

Overview

Lack of proper logging and monitoring makes it difficult to detect and respond to security incidents.

Example

  • No logs for failed login attempts.
  • Logs stored in plaintext without encryption.

Mitigation

  • Implement centralized logging.
  • Monitor logs for anomalous activity.
  • Use SIEM (Security Information and Event Management) tools.

10. Server-Side Request Forgery (SSRF) (A10:2021)

Overview

SSRF occurs when an attacker can force a server to make HTTP requests to unintended locations, potentially accessing internal services.

Example

GET /fetch?url=http://localhost:8080/admin

Mitigation

  • Implement allowlists for outbound requests.
  • Restrict requests to internal resources.
  • Use firewalls and network segmentation.

Conclusion

Understanding and mitigating these OWASP Top 10 vulnerabilities is crucial for securing modern web applications. By implementing best practices, regular security audits, and secure coding standards, developers can reduce risks and build robust applications.

🔒 Stay secure and keep coding safely! 🚀

Last updated: February 25, 2025