vulnerabilities/bac/README.md
This module demonstrates OWASP Top 10 2021's #1 vulnerability: Broken Access Control (BAC). It provides a practical learning environment showing how access control vulnerabilities can be exploited and properly mitigated.
The module simulates a user profile viewing system with progressive security levels:
Input Validation
/^\d+$/Access Control
Database Security
-- Users table modifications
ALTER TABLE users ADD COLUMN role VARCHAR(20) DEFAULT 'user';
ALTER TABLE users ADD COLUMN account_enabled TINYINT(1) DEFAULT 1;
-- Access logging
CREATE TABLE access_log (
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT NOT NULL,
target_id INT NOT NULL,
action VARCHAR(50) NOT NULL,
timestamp DATETIME NOT NULL
);
-- Security monitoring
CREATE TABLE security_log (
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT NOT NULL,
action VARCHAR(50) NOT NULL,
target_id VARCHAR(50),
timestamp DATETIME NOT NULL,
ip_address VARCHAR(45)
);
Input Validation Testing
Access Control Testing
Rate Limiting Testing