OWASP Top 10 Security Lab

A01

Broken Access Control

Learn to identify and exploit access control vulnerabilities

What is Broken Access Control?

Broken Access Control is the #1 vulnerability in the OWASP Top 10 2021. It occurs when restrictions on what authenticated users are allowed to do are not properly enforced. This can lead to unauthorized information disclosure, modification, or destruction of data, or performing business functions outside the user's limits.

🎯 Common Attack Scenarios

  • Insecure Direct Object References (IDOR): Accessing other users' data by manipulating parameters
  • Privilege Escalation: Acting as a user without being logged in or acting as an admin when logged in as a user
  • Metadata Manipulation: Replaying or tampering with JWT tokens, cookies, or hidden fields
  • CORS Misconfiguration: Allowing unauthorized API access
  • Force Browsing: Accessing authenticated pages as an unauthenticated user

⚠️ Impact

The impact of access control vulnerabilities can be severe:

  • Unauthorized access to sensitive data
  • Data modification or deletion
  • Performing unauthorized business functions
  • Complete account takeover
  • Regulatory compliance violations

🛡️ Prevention

  • Implement proper authentication and session management
  • Use role-based access control (RBAC)
  • Validate user permissions on every request
  • Log access control failures and alert admins
  • Rate limit API and controller access
  • Disable web server directory listing
# Example of Vulnerable Code (PHP) $user_id = $_GET['user_id']; $query = "SELECT * FROM users WHERE id = $user_id"; // No access control check! # Secure Code $user_id = $_GET['user_id']; $current_user = getCurrentUser(); if ($current_user['id'] != $user_id && !$current_user['is_admin']) { throw new UnauthorizedException(); } $query = "SELECT * FROM users WHERE id = $user_id";

🔍 How to Test

In the following labs, you'll practice identifying and exploiting broken access control vulnerabilities:

  • Lab 1: Insecure Direct Object Reference (IDOR) - Learn how attackers can access other users' data
  • Lab 2: Privilege Escalation - Discover how to gain unauthorized admin access