The Route the Error Page Listed: Finding Hidden Endpoints Through Django's Debug 404
The challenge
Fernway's Django site runs with DEBUG on. Request a page that does not exist. Bring back the bucket holding passenger data.
What you'll learn
- Recognise Django's technical 404 page and what DEBUG = True exposes
- Use a debug page's URL pattern list to map routes a site never links to
- Read Django's own redirects and errors (301, 302, 403, 405) while exploring
- Explain why DEBUG = False needs a correct ALLOWED_HOSTS
- Protect internal endpoints with authentication instead of obscurity
Skills tested
Prerequisites
- What a URL path is
- What an HTTP status code means
How it works
Django's DEBUG setting turns on developer-friendly error pages. When no URL pattern matches a request, Django normally returns a short 404. With DEBUG = True it returns a technical 404 instead: the request method and URL, the name of the URLconf module, and every URL pattern it tried, in order, with their names. That is the complete route map of the application, including endpoints that no page links to.
Other debug pages leak even more: an unhandled exception shows the traceback with local variables and a filtered dump of the settings. Search engines and scanners find these pages routinely, which is why Django debug mode enabled is a classic finding in bug bounty recon.
The page itself is not the vulnerability that loses the data; it is the map. The real damage comes when the map shows an endpoint that relied on nobody knowing its URL.
Common mistakes
- Answering the health check's bucket.
healthz/reportss3://fw-media-public-eu/, the public media bucket. The passenger data goes to the bucket ininternal/exports/manifest/:fw-manifests-prod-f800. - Dropping the trailing slash.
/internal/exports/manifestanswers a 301 to the same path with a slash: Django'sAPPEND_SLASH. Follow it or type the route exactly as listed. - Stopping at the admin.
admin/only redirects to a login page. Guessing passwords is not the move: the open route is. - Changing the method. A POST to a real route is refused by Django's CSRF protection (403), and HEAD on these JSON views is a 405. Plain GET is enough.
- Changing the Host header. The load balancer only forwards Fernway's own hostnames; anything else gets its fixed 404.
How to defend against it
- Set
DEBUG = Falsein production, ideally from an environment variable that defaults to off. - Set
ALLOWED_HOSTSto your real domains: withDEBUG = Falsean empty list makes Django answer 400 to everything, which is a common reason teams turn debug back on. - Put internal and monitoring endpoints behind authentication (a token, mTLS, or staff login) or serve them on a separate internal listener that the public load balancer never routes to.
- Run
python manage.py check --deploybefore each release: it flagsDEBUGand other unsafe production settings. - Scan your own sites for debug pages, and alert on 404 responses that contain Django tried these URL patterns.