Debug Mode Enabled in Production
The application or its framework runs with debug settings in production, exposing detailed errors, internal data and sometimes interactive debugging tools.
| Severity | Medium |
| CVSS 3.1 | 5.3 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N Open in the calculator |
| CVSS 4.0 | 6.9 CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N Open in the calculator |
| CWE | CWE-489: Active Debug Code |
| OWASP Top 10 | A02:2025 Security Misconfiguration |
| MITRE ATT&CK | T1592.002 Software |
| Category | Security Misconfiguration |
Description
The application, or the framework it is built on, is running in production with settings intended for development. The signs vary by platform: Django with DEBUG = True, which shows detailed error pages and, for unknown addresses, a list of the application's URL patterns; Flask run with the Werkzeug debugger enabled; Laravel with APP_DEBUG=true; Symfony in its development environment, with the web profiler at /_profiler; Ruby on Rails in development mode; ASP.NET with customErrors set to Off or with debug="true" on the compilation element; ASP.NET Core in the Development environment with the developer exception page; and Express applications run without NODE_ENV=production.
Debug output typically includes stack traces, fragments of source code, framework and library versions, file paths, database queries, request data and, on some platforms, configuration values and environment variables. Anyone who can reach the application can usually trigger it, without authentication, and so learn how the application is built and configured, which makes finding and exploiting other weaknesses considerably easier. Where configuration values or environment variables are shown, the output can disclose credentials and secret keys directly.
Some debug tools go further: the Werkzeug debugger offers an interactive Python console in the browser, protected by a PIN that can sometimes be derived from information disclosed elsewhere. Where an interactive debugger or console is reachable, an attacker who can use it can run code on the server with the application's privileges.
Debug mode is identified by causing errors, for example by requesting addresses that do not exist or sending malformed input, and by recognising framework debug pages, profiler toolbars, debug headers such as Symfony's X-Debug-Token, and known debug paths. Web scanners recognise the debug pages of the common frameworks.
Remediation
Run production with production settings, and make that hard to get wrong:
- Turn debug settings off in the production configuration of each platform in use, as below, and run Python applications under a production server rather than the framework's development server.
- Leave development-only packages, such as profilers and debug toolbars, out of production builds, for example by using
composer install --no-devfor PHP applications. - Show users a generic error page with a reference number, and record the details in server-side logs.
- Add a check to the deployment pipeline that fails the release if a debug setting is enabled.
- If an interactive debugger was reachable, review the server for signs of misuse and rotate the secrets the application holds.
Confirm the fix by repeating the requests that produced debug output: each should return a generic error page.
References
Add This Finding to Your Library
In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.
Free trialYour trial starts when your portal goes live, not when you sign up, so the time you spend setting up does not count. · No card required
Only need the reporting? Our reporting tool is free and open source, with the same library.