Objective
Verify that application errors do not unnecessarily disclose sensitive implementation details, internal paths, infrastructure information, debugging data, credentials or other information that could assist an attacker.
Error handling is part of the application's security boundary. Invalid requests, malformed input, missing resources and unexpected application failures should result in controlled responses appropriate for the deployment environment.
Production systems should not expose development diagnostics merely because an unexpected condition occurs.
A generic error message is not always necessary, and a detailed error can sometimes be legitimate. Assess whether the disclosed information creates meaningful security impact rather than treating every technical message as a vulnerability.
Scope
Review error behavior across representative application surfaces, including:
Prerequisites
| Authorization | Confirm authorization to generate controlled application errors. |
|---|---|
| Test environment | Prefer a dedicated test environment where malformed requests can safely be generated. |
| Application architecture | Identify application servers, frameworks, reverse proxies and error-handling layers. |
| Logging access | Obtain authorized access to server or application logs where required to distinguish client-safe errors from internal diagnostics. |
Methodology
Generate controlled invalid conditions and inspect the resulting response. The objective is to determine whether the client receives only the information necessary to understand the failure.
| Method | Purpose |
|---|---|
| Invalid request testing | Determine how malformed requests are handled. |
| Resource error testing | Review 4xx and 5xx responses for unnecessary technical information. |
| Exception testing | Determine whether unexpected server failures expose debugging information. |
| Configuration review | Determine whether production debugging or verbose exception handling is enabled. |
Test procedure
Information to look for
| Information | Security concern |
|---|---|
| Stack traces | May reveal application structure, source locations and implementation details. |
| Absolute file paths | May disclose server filesystem structure. |
| Database errors | May disclose database technology, schema information or query details. |
| Internal hostnames | May expose internal infrastructure information. |
| Software versions | May assist technology fingerprinting and vulnerability research. |
| Configuration values | May disclose sensitive deployment information or secrets. |
| Debug panels | May expose extensive application state and privileged diagnostic information. |
Example unsafe response
HTTP/1.1 500 Internal Server Error
Content-Type: text/html
RuntimeException:
Database connection failed
File:
/var/www/application/src/Database/Connection.php
Framework:
ExampleFramework 4.x
Stack trace:
#0 /var/www/application/src/...
#1 /var/www/application/src/...
The example is intentionally generic. The security concern is the unnecessary disclosure of internal implementation and infrastructure information to the client.
Example controlled response
HTTP/1.1 500 Internal Server Error
Content-Type: application/json
{
"error": "An unexpected error occurred.",
"request_id": "8f42c1..."
}
Detailed diagnostics should be retained in appropriate protected server-side logs rather than returned directly to an untrusted client.
Assessment
| Condition | Assessment |
|---|---|
| Generic client-safe error | Generally appropriate when detailed diagnostics are unnecessary to the client. |
| Correlation/request identifier | Useful when it allows support teams to locate server-side diagnostics without exposing those diagnostics. |
| Stack trace exposed | Assess disclosed information and whether it creates meaningful attack value. |
| Internal filesystem path exposed | Record the information disclosed and determine whether it assists further attacks. |
| Secrets or credentials exposed | Treat as a serious information disclosure requiring immediate containment and credential rotation where applicable. |
Expected result
Error responses provide clients with only the information necessary for the intended interaction, while detailed diagnostics remain protected within server-side logging and monitoring systems.
Production responses should not expose stack traces, source-code locations, internal infrastructure details, database diagnostics, secrets or debugging interfaces.
Failure criteria
A production application returns a detailed server-side exception containing an absolute filesystem path and framework implementation details. The same information is not required for the user to understand the failure.
Remediation
Implement centralized exception handling that separates information intended for the client from diagnostic information intended for authorized operators.
Recommended approach
- Disable development/debug output in production.
- Implement centralized exception handling.
- Return generic client-safe error messages.
- Log detailed diagnostic information on the server.
- Restrict access to diagnostic logs and monitoring systems.
- Remove secrets from exception messages and logs.
- Review framework and web-server error pages.
- Configure consistent handling for application, proxy and server-generated errors.
- Use request or correlation identifiers to connect client errors with protected server-side diagnostics.
- Test error handling after every major deployment configuration change.
Example application response
try {
processRequest();
} catch (Throwable $e) {
$requestId = createRequestId();
logException($requestId, $e);
return jsonResponse(
500,
[
"error" => "An unexpected error occurred.",
"request_id" => $requestId
]
);
}
The implementation above is conceptual. The exact exception-handling mechanism depends on the application's language and framework.
Verification
Client responses are controlled and detailed diagnostics remain protected.
Sensitive implementation or diagnostic information remains exposed.
The relevant error condition or environment could not be adequately verified.
Evidence requirements
Before publishing evidence, remove passwords, credentials, tokens, connection strings, private addresses and other sensitive information. If the finding itself contains a secret, treat the secret as compromised and follow the organization's incident and credential-rotation procedures.
Classification
| WebOTG procedure | WebOTG-SM-007 |
|---|---|
| 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 information disclosed and its practical security impact. |
WebOTG-SM-007 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 | Web application security testing methodology. |
| OWASP Application Security Verification Standard | Application security verification requirements related to error handling, information exposure and secure implementation. |
| OWASP Error Handling Cheat Sheet | Guidance for secure application error handling and information disclosure. |
| Vendor framework documentation | Production error handling and debug configuration requirements. |
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.