Verbose Error Messages

Error responses reveal internal details such as stack traces, file paths, software versions or database queries that help an attacker plan further attacks.

SeverityLow
CVSS 3.13.7 CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N Open in the calculator
CVSS 4.06.3 CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N Open in the calculator
CWECWE-209: Generation of Error Message Containing Sensitive Information
OWASP Top 10A10:2025 Mishandling of Exceptional Conditions
MITRE ATT&CKT1592.002 Software
CategoryInformation Disclosure

Description

When the application meets an unexpected condition, such as malformed input, a missing parameter or a failed database call, it returns detailed diagnostic information to the user instead of a generic message. Typical examples are full stack traces from Java, .NET, Python or PHP code; framework error pages; database error messages that include fragments of the failing SQL query; and messages that disclose server-side file paths, internal host names, configuration values or the exact versions of components in use. The behaviour usually stems from development settings left in place, error handling that passes exception text straight to the response, or web server and framework default error pages shown in production.

The details do not compromise the application by themselves, but they reduce the effort needed to attack it: software versions can be matched to known vulnerabilities, paths and queries reveal how the application is built, and error behaviour can confirm whether an injection attempt is reaching the back end. Occasionally error output includes more sensitive values, such as connection strings, credentials or other users' data, in which case the impact is higher and the finding should be rated on what was exposed.

The weakness is identified by sending unexpected input (wrong data types, very long values, special characters, unexpected HTTP methods or malformed requests) to each function and reviewing the responses; automated scanners flag recognisable stack trace and database error patterns. A database error that reflects injected syntax is a strong indicator of SQL injection and should be investigated, and reported, as that issue. This finding covers the disclosure itself.

Remediation

  • Configure a global exception handler that logs full details on the server with a correlation identifier and returns a generic message and an appropriate status code to the user. Include the identifier in the response so that support staff can find the log entry.
  • Disable development error output in production. For example, set customErrors to On or RemoteOnly in ASP.NET, use the developer exception page only in the Development environment in ASP.NET Core, set display_errors = Off in PHP, set DEBUG = False in Django and set APP_DEBUG=false in Laravel.
  • Replace the default error pages of the web server and application server with custom pages for common status codes such as 400, 403, 404 and 500.
  • Return consistent, generic error responses from APIs, for example in a problem details format without exception text.
  • Check what is logged, so that secrets are not written to the logs instead.

Confirm the fix by repeating the inputs that produced detailed errors and checking that only generic messages are returned.

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 trial  ·  No card required

Only need the reporting? Our reporting tool is free and open source, with the same library.


More Web Applications Findings

Every Web Applications finding