Debug & Error Information Disclosure
Stack traces, SQL errors and framework debug pages leak server file paths, database structure and library versions straight into the response.
Results in 1–3 minutes · Free · No signup required
Why It Matters
Debug output is reconnaissance handed to the attacker for free: a SQL error confirms an injection point and names your tables, a stack trace maps your directory layout and framework version, and a debug toolbar can expose environment variables and database credentials outright.
How We Check
We scan the response for PHP fatal errors, warnings and stack traces with server paths, MySQL/PostgreSQL error strings and raw SQL, ORM exceptions, and framework debug pages left enabled in production.
Good vs Bad Values
| Value | Verdict | Why |
|---|---|---|
A generic 500 page: "Something went wrong" with a request ID | Good | Tells the visitor nothing about the stack. The ID lets support find the details in the logs. |
A 404 page in the site's own design | Good | No framework banner, no version, no path. Not reported. |
Fatal error: Uncaught Exception … in /var/www/html/index.php:42 | Bad | PHP error with a filesystem path, usually because display_errors is on. |
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version | Bad | Confirms user input reaches a query and shows the database engine. Critical in the check. |
Traceback (most recent call last): File "/app/views.py" | Bad | A Python traceback with file paths. The Django yellow debug page (with Request URL and settings) is critical. |
Whitelabel Error Page (Spring Boot) or at com.example.Service(Service.java:88) | Bad | Java stack frames and package names, or the default error page, in production. |
X-Debug-Token or X-Clockwork-Id response header | Bad | The Symfony profiler or the Laravel Clockwork profiler is enabled. Both expose request details. |
A help article that quotes "Update your profile settings from the account page" | Weak | The raw-SQL pattern is loose: a verb, then 20 to 200 characters, then FROM or WHERE can match ordinary English. Check the matched text before acting. |
How to Fix
Turn debug mode off in production (display_errors=Off, APP_DEBUG=false, DEBUG=False) and log errors to a file or an observability backend instead of the response body. Return generic error pages for 4xx/5xx, and make sure the generic handler covers unhandled exceptions too.
Per framework, set the production switch:
; php.ini
display_errors = Off
log_errors = On
error_log = /var/log/php/error.log
# Laravel .env, then cache the config
APP_ENV=production
APP_DEBUG=false
php artisan config:cache
# Django settings
DEBUG = False
ALLOWED_HOSTS = ['example.com']
# Flask: never run with app.run(debug=True) in production
Rails: config.consider_all_requests_local = false in config/environments/production.rb. Spring Boot: server.error.include-stacktrace=never, server.error.include-message=never and server.error.whitelabel.enabled=false. Express: set NODE_ENV=production, which makes the default error handler hide stack traces, and add your own final handler. ASP.NET Core: use app.UseExceptionHandler("/error") outside the Development environment, and never UseDeveloperExceptionPage in production. Symfony: APP_ENV=prod; Laravel Clockwork: CLOCKWORK_ENABLE=false.
A last line of defence at the proxy — replace upstream error bodies with your own page:
proxy_intercept_errors on;
error_page 500 502 503 504 /errors/50x.html;
location = /errors/50x.html { internal; root /var/www/static; }
ErrorDocument 500 /errors/50x.html
ErrorDocument 503 /errors/50x.html
Express final handler:
app.use((err, req, res, next) => {
console.error(err); // full detail goes to the log
res.status(500).send('Something went wrong'); // generic text to the client
});
Verify: request a missing page, a malformed URL (/?id=') and an endpoint that throws, and read the raw responses with curl -i. None should contain a file path, a SQL fragment, a class name or a framework banner. Then confirm the details arrive in your log or error tracker.
Common Mistakes
- Turning off debug in the application but leaving the web server or PHP-FPM to print errors. Check each layer.
- Testing only 404. The leak usually appears on an unhandled exception, a malformed request or a database timeout.
- Leaving a development profiler enabled because it is behind a query parameter. The header still advertises it.
- Logging to the response instead of a file because the log directory was not writable on the server.
- Deploying with the environment variable from staging. APP_DEBUG=true in a copied .env is a common cause.
- Showing the exception message to the user to be helpful. The message can contain SQL, paths and parameter values.
Frequently Asked Questions
What is Debug & Error Information Disclosure?
Stack traces, SQL errors and framework debug pages leak server file paths, database structure and library versions straight into the response.
Why does Debug & Error Information Disclosure matter for website security?
Debug output is reconnaissance handed to the attacker for free: a SQL error confirms an injection point and names your tables, a stack trace maps your directory layout and framework version, and a debug toolbar can expose environment variables and database credentials outright.
How do I fix Debug & Error Information Disclosure issues?
Turn debug mode off in production (display_errors=Off, APP_DEBUG=false, DEBUG=False) and log errors to a file or an observability backend instead of the response body. Return generic error pages for 4xx/5xx, and make sure the generic handler covers unhandled exceptions too.
Related Security Checks
Check Your Website Now
Run a free security scan to check for Debug & Error Information Disclosure issues and 61 other security checks.
Scan Your Website Free