high Information Disclosure

Debug Mode Enabled in Production

Stack traces and verbose errors are shown to visitors, leaking file paths, credentials and internal application structure.

Severity
high
Time to Fix
10 minutes
Difficulty
easy
OWASP
A05:2021 — Security Misconfiguration

What is Debug Mode Enabled in Production?

Debug modes exist to make development productive — and to make incidents worse. Laravel with APP_DEBUG=true renders the full "Whoops" page: the stack trace, every file path on the server, the current environment variables (including database credentials on many setups), and the query that failed. ASP.NET with custom errors off leaks similar detail; verbose PHP errors expose paths, SQL fragments, and library versions. Each element is a puzzle piece for the attacker: file paths reveal the framework and structure, versions reveal known vulnerabilities, and env variables sometimes hand over the credentials outright.

Why It Matters to Your Business

Debug output converts any minor error — a bad parameter, a failed query — into a reconnaissance report about your application. Attackers deliberately trigger errors (malformed JSON, oversized integers, weird encodings) to farm these traces. Documented escalations include database credentials leaked through trace pages and framework versions matched to public exploits. Beyond security, verbose errors look unprofessional and can expose personal data in error contexts, which itself is a reportable disclosure under GDPR.

How to Fix It

Turn debug off in production and keep it off:

Laravel (.env on the production server):
  APP_DEBUG=false
  APP_ENV=production

PHP (php.ini for the FPM pool):
  display_errors = Off
  log_errors = On
  error_log = /var/log/php/error.log

ASP.NET (web.config):
  <customErrors mode="On" />
  <httpErrors errorMode="Custom" />

Django (settings.py):
  DEBUG = False
  ALLOWED_HOSTS = ['yoursite.com']

Deploy pipelines: make production deploys FAIL if debug flags are on — a single environment check in CI prevents the classic 'worked locally' mistake.

Debug the right way: structured logs (and staging with a copy of data) instead of on-screen traces.

Frequently Asked Questions

What exactly leaks in a stack trace?

File system paths, framework and library versions, SQL queries, request parameters, and — in Laravel's debug page and many error handlers — the full environment configuration including database credentials. Each detail narrows the attacker's work.

How do I debug production issues without debug mode?

Structured application logs with proper levels, an error tracker (Sentry and similar), and a staging environment that mirrors production. You get more detail than a stack trace, without exposing it to the internet.

Why is a stack trace dangerous if it shows no passwords?

Paths and versions alone let attackers fingerprint your stack precisely and target known vulnerabilities for exactly your framework and versions — turning generic attacks into targeted ones.

Technical Classification

OWASP CategoryA05:2021 — Security Misconfiguration
CWE IDCWE-489: Active Debug Code
Detected Bydebug_exposure, info_disclosure scanner(s)
Severity Levelhigh

How 2MNY Security Can Help

Check if your website has this vulnerability

Our debug_exposure, info_disclosure scanner checks for this issue automatically.

Scan My Website Free

Related Vulnerabilities