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.
| Severity | Low |
| CVSS 3.1 | 3.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.0 | 6.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 |
| CWE | CWE-209: Generation of Error Message Containing Sensitive Information |
| OWASP Top 10 | A10:2025 Mishandling of Exceptional Conditions |
| MITRE ATT&CK | T1592.002 Software |
| Category | Information 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
customErrorstoOnorRemoteOnlyin ASP.NET, use the developer exception page only in the Development environment in ASP.NET Core, setdisplay_errors = Offin PHP, setDEBUG = Falsein Django and setAPP_DEBUG=falsein 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 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.