Objective
Verify that application errors presented to untrusted users do not unnecessarily disclose internal technical information that could assist reconnaissance, exploitation or identification of the application's underlying infrastructure.
Applications inevitably encounter invalid requests, missing resources, unexpected input and internal failures. The security requirement is not that errors never occur, but that externally visible error responses expose only information appropriate for the requesting user.
Detailed diagnostic information should normally remain available to authorized operators through controlled logging and monitoring systems rather than being returned directly to clients.
Client-facing responses can provide a meaningful error identifier and appropriate user guidance without exposing source-code paths, framework internals, database details or debugging output.
Scope
Review error behavior across:
Prerequisites
| Authorization | Confirm authorization to test the application and trigger error conditions. |
|---|---|
| Application architecture | Understand relevant application, framework, API, database and proxy layers. |
| Logging model | Where possible, understand how detailed diagnostic information is captured internally. |
| Environment | Determine whether the target represents production, staging or another controlled environment. |
Methodology
Trigger controlled error conditions and inspect the resulting client-visible response. Determine whether the information disclosed exceeds what is necessary for the requesting party.
| Review | Purpose |
|---|---|
| Response body | Identify stack traces, exception details, source fragments and internal messages. |
| Response headers | Identify unnecessary technology, framework or infrastructure information. |
| Error status | Confirm that the application returns appropriate HTTP status behavior. |
| Error consistency | Determine whether different routes or environments expose inconsistent detail. |
| Diagnostic correlation | Determine whether detailed diagnostics are available internally without being exposed to the client. |
Test procedure
Information disclosure types
Internal call stacks, class names, methods, source files and line numbers.
Server filesystem paths, application directories and deployment locations.
SQL statements, table names, database engines or internal connection information.
Framework exceptions, debug pages and unnecessary implementation details.
Private hostnames, internal service addresses and infrastructure identifiers.
Environment variables, configuration fragments, feature flags or deployment information.
Example unsafe response
HTTP/1.1 500 Internal Server Error
Content-Type: text/html
RuntimeException:
Database connection failed
at /var/www/application/src/Database/UserRepository.php:184
at /var/www/application/src/Controller/UserController.php:72
SQLSTATE[HY000]:
Connection refused to database.internal.example
Example safer response
HTTP/1.1 500 Internal Server Error
Content-Type: application/json
{
"error": "An unexpected error occurred.",
"request_id": "REQ-2026-000184"
}
A non-sensitive request or correlation identifier can allow support personnel to locate detailed server-side diagnostics without returning the diagnostic content itself to the client.
Assessment
| Condition | Assessment consideration |
|---|---|
| Generic client-facing error | Normally appropriate if it does not hide information required for legitimate users. |
| Stack trace exposed | Assess disclosed paths, classes, methods and whether they materially assist reconnaissance or exploitation. |
| Database details exposed | Determine whether database technology, schema information or query details are unnecessarily disclosed. |
| Framework debug page exposed | Determine whether development diagnostics are enabled in an untrusted environment. |
| Technology identification only | Do not automatically classify a minor technology disclosure as a vulnerability. Consider actual security impact. |
Expected result
Client-facing error responses provide appropriate information for legitimate users without exposing unnecessary implementation, infrastructure or diagnostic details.
Detailed diagnostic information should be available to authorized operators through controlled server-side logging and monitoring mechanisms.
Failure criteria
A production endpoint returns an unhandled exception containing a server filesystem path, source-code location and backend implementation details. The information is unnecessary for the requesting client and provides useful reconnaissance data about the application's internal structure.
Remediation
Separate client-facing error handling from internal diagnostic handling. Return controlled error responses while retaining sufficient server-side information for incident investigation and operational troubleshooting.
Recommended approach
- Disable development and debug modes in production.
- Implement centralized exception handling.
- Return generic client-facing error messages where detailed diagnostics are unnecessary.
- Record detailed diagnostics in protected server-side logs.
- Use correlation or request identifiers where useful for operational troubleshooting.
- Prevent credentials, tokens, secrets and sensitive configuration values from entering error responses or logs.
- Review reverse-proxy and gateway error pages in addition to application-generated errors.
- Apply consistent error handling across all production routes and application states.
- Ensure error logging itself is protected against unauthorized access.
- Re-test representative failure conditions after remediation.
Conceptual error-handling architecture
Application exception
|
+----------------------+
| |
v v
Server-side logging Error handler
| |
| v
| Generic response
| |
| v
| Client
|
v
Detailed diagnostics
for authorized operators
Removing diagnostic information entirely is not a proper security fix. It can destroy the ability to investigate failures and security incidents. The correct boundary is to keep detailed diagnostics server-side and control who can access them.
Verification
Error responses are appropriately sanitized and detailed diagnostics remain available through controlled internal mechanisms.
Material internal or sensitive information remains exposed to the client.
Relevant failure conditions could not be adequately exercised or evaluated.
Evidence requirements
Sanitize credentials, API keys, session tokens, personal information, private hostnames and other sensitive values before publishing screenshots, response captures or examples.
Classification
| WebOTG procedure | WebOTG-SM-021 |
|---|---|
| OWASP category | A02:2025 — Security Misconfiguration |
| Procedure type | Error handling and information disclosure review |
| Assessment result | PASS / FAIL / NOT TESTED |
| Finding severity | Determine from the sensitivity of the disclosed information, exposure boundary, exploitability and resulting impact. |
WebOTG-SM-021 is a WebOTG-defined verification procedure. The identifier is not an OWASP-defined test identifier.
References
| Source | Relevance |
|---|---|
| OWASP Top 10:2025 — A02 | Security Misconfiguration category. |
| OWASP Web Security Testing Guide | Testing methodology relevant to error handling and information disclosure. |
| OWASP Application Security Verification Standard | Verification requirements relevant to secure error handling and information exposure. |
| Application security architecture | Defines appropriate separation between client-facing errors and internal diagnostics. |
| Organizational logging policy | Defines requirements for protected server-side diagnostic information. |
WebOTG should maintain official source URLs, source versions and review dates through its content-management system so references can be updated independently of the procedure template.