# Direct Request ('Forced Browsing') (CWE-425) The web application does not adequately enforce appropriate authorization on all restricted URLs, scripts, or files. - Prevalence: Hoch Häufig ausgenutzt - Impact: Hoch 1 Regeln mit hohem Schweregrad - Prevention: Dokumentiert 1 Fix-Beispiele **OWASP:** Broken Access Control (A01:2021-Broken Access Control) - #1 ## Description Attackers can directly access URLs that should be protected by authentication or authorization. This often occurs when access controls are only enforced on the main navigation but not on direct URL access. ## Prevention ### Python Add authentication and admin-role checks to all administrative endpoints ## Warning Signs - [HIGH] administrative endpoints (admin, debug, internal, system) that lack proper authentication or authori ## Consequences - Anwendungsdaten lesen - Anwendungsdaten ändern - Privilegien erlangen ## Mitigations - Serverseitige Zugriffskontrollen für alle geschützten Ressourcen implementieren - Sich nicht allein auf clientseitige Zugriffskontrollen verlassen - Einen zentralisierten Autorisierungsmechanismus verwenden ## Detection - Total rules: 1 - Languages: python ## Rules by Language ### Python (1 rules) - **Exposed Administrative Endpoint** [HIGH]: Detects administrative endpoints (admin, debug, internal, system) that lack proper authentication or authorization checks. These endpoints should require admin privileges and be protected from public access. - Remediation: Add authentication decorator to admin endpoints. ```python from flask_login import login_required, current_user from functools import wraps def admin_required(f): @wraps(f) @login_required def decorated(*args, **kwargs): if not current_user.is_admin: abort(403) return f(*args, **kwargs) return decorated @app.route('/admin/users') @admin_required def admin_users(): return jsonify(get_users()) ``` Learn more: https://shoulder.dev/learn/python/cwe-425/exposed-admin-endpoint