Web server treats /admin/dashboard as protected and requires authentication. But /Admin/dashboard bypasses protection due to case-insensitive filesystem.
# Vulnerable - assumes user_id immutable
@app.route('/profile/<user_id>')
def get_profile(user_id):
if not authenticated():
return "Unauthorized"
return get_user_data(user_id)
# Authenticate as user 1
curl -H "Authorization: Bearer token1" http://example.com/profile/1
# Then modify user_id
curl -H "Authorization: Bearer token1" http://example.com/profile/999
# Access user 999's data with user 1's token!
# Weak authentication - can be bypassed
if password == stored_hash:
authenticated = True
# Then trusted for all operations
if authenticated:
grant_admin_access() # Assumes primary auth is strong
# Check exact username, not similar
allowed_usernames = ['admin', 'administrator']
if username not in allowed_usernames:
return "Unauthorized"
# Bad
if request.headers.get('X-Forwarded-For') == 'trusted-ip':
grant_access()
# Good
# Use server-verified IP from connection
client_ip = request.remote_addr
if client_ip in TRUSTED_INTERNAL_IPS:
grant_access()
# Store user_id in session, don't accept from request
user_id = session['user_id'] # Not from URL parameter