Overview
Forced Browsing is a vulnerability where an attacker gains access to a resource (a page, file, or endpoint) simply by knowing or guessing the URL. These resources are “protected” only because no legitimate link points to them, but they lack any access control checks. This is a specific type of Improper Access Control (CWE-284).
Business Impact
Forced Browsing can lead to the exposure of sensitive administrative panels, internal debug information, configuration files, or un-published content. This can result in data breaches or give an attacker a foothold for further attacks.Reference Details
CWE ID: CWE-425
OWASP Top 10 (2021): A01:2021 - Broken Access Control
Severity: Medium
Framework-Specific Analysis and Remediation
This vulnerability is caused by a developer creating a new endpoint and forgetting to apply the framework’s authorization controls (middleware, decorators, attributes, or filters). The solution is to ensure every single endpoint has a default “deny” policy, and only explicitly public endpoints are reachable.- Python
- Java
- .NET(C#)
- PHP
- Node.js
- Ruby
Framework Context
A developer adds a URL pattern inurls.py for an admin-only view but forgets to add @login_required or @user_passes_test to the view.Vulnerable Scenario 1: Unprotected Admin View
A view is created for a special “profit report” that should be admin-only, but no decorator is added.Vulnerable Scenario 2: Unprotected Debug Endpoint
A developer adds a temporary view to debug system state but forgets to remove it or protect it.Mitigation and Best Practices
Wrap the view inlogin_required and user_passes_test(lambda u: u.is_staff) in urls.py or apply them as decorators in views.py.Secure Code Example
Testing Strategy
Write an integration test that uses an unauthenticated client toGET the /reports/profit-panel/ URL. Assert that the response is a redirect (to login) or a 403 Forbidden, not a 200 OK.
