Objective
Verify that application error responses provide sufficient information for legitimate users while preventing unnecessary disclosure of internal implementation, configuration or security-sensitive details.
Applications inevitably encounter invalid requests, failed operations and unexpected conditions. Error handling becomes a security concern when responses expose information that an untrusted user does not need to know.
Examples include stack traces, source-code locations, internal hostnames, filesystem paths, database details, framework diagnostics, configuration values and debugging information.
Developers and operators may require detailed diagnostic information. That does not mean those details should be returned to public clients. Diagnostic information should normally be captured through controlled server-side logging or monitoring.
Scope
Review error handling across:
Prerequisites
| Authorization | Confirm explicit authorization to perform application security testing. |
|---|---|
| Test environment | Prefer a non-production environment where testing can safely generate controlled application errors. |
| Application documentation | Identify supported error-handling behavior and expected client-facing responses. |
| Logging access | Where available, obtain authorized access to server-side logs for comparison between client-visible and internal diagnostics. |
Methodology
Generate controlled error conditions and inspect the resulting client response. Determine whether the response contains information unnecessary for the client to understand or recover from the error.
| Method | Purpose |
|---|---|
| Invalid input testing | Determine how the application handles malformed or unexpected input. |
| Invalid resource testing | Review responses for nonexistent or unavailable resources. |
| Authentication testing | Review information disclosed during authentication failures. |
| API response review | Determine whether structured error responses disclose internal details. |
| Configuration review | Verify that production diagnostic or debug modes are not unnecessarily exposed. |
Test procedure
Error categories
| Error type | Review focus |
|---|---|
| Validation error | Ensure the response explains the invalid input without exposing internal processing details. |
| Authentication error | Avoid unnecessary information about authentication internals or account processing. |
| Authorization error | Return an appropriate access-denied response without revealing sensitive implementation information. |
| Database error | Do not expose SQL statements, database schema details, connection information or backend diagnostics. |
| Application exception | Do not expose stack traces, source paths, class names or internal exception details. |
| Gateway / server error | Ensure infrastructure errors do not unnecessarily disclose server software, topology or internal paths. |
Example of excessive disclosure
{
"error": "DatabaseException",
"message": "Query failed",
"sql": "SELECT * FROM users WHERE id = ?",
"database": "production_users",
"host": "db-internal-02",
"source": "/var/www/app/src/UserRepository.php:184",
"trace": "..."
}
The client generally does not require the SQL statement, internal database name, internal hostname, source path or stack trace to understand that the request failed.
Preferred client-facing response
{
"error": "request_failed",
"message": "The request could not be completed.",
"request_id": "8f31c2a1"
}
Detailed diagnostic information should remain in controlled server-side logging and be associated with the request identifier where appropriate.
Assessment
| Information disclosed | Assessment consideration |
|---|---|
| Generic error message | Normally acceptable if sufficient for legitimate client handling. |
| Request identifier | Generally useful for support and server-side correlation. |
| Framework or library details | Determine whether disclosure is necessary and whether it increases unnecessary information exposure. |
| Filesystem paths | Generally unnecessary for clients and should not be disclosed. |
| Stack traces | Should normally remain server-side. |
| SQL statements | Should not normally be returned to untrusted clients. |
| Internal hostnames | Review whether disclosure is necessary; internal infrastructure information should generally remain private. |
| Secrets or credentials | Treat as a serious security finding and initiate appropriate incident handling if actual secrets were exposed. |
Expected result
Client-facing error responses disclose only the information necessary for legitimate application behavior and support, while detailed diagnostic information remains within controlled server-side logging and monitoring systems.
Production systems should not expose development diagnostics such as stack traces, source locations, debugging panels or backend exception details to untrusted clients.
Failure criteria
A production application returns a detailed exception response containing an internal filesystem path and source-code location. These details are not required by the client and provide unnecessary implementation information to an untrusted party.
Remediation
Separate client-facing error handling from internal diagnostics. The client should receive a controlled error representation, while detailed diagnostic information should be captured through protected operational channels.
Recommended approach
- Implement centralized exception and error handling.
- Disable verbose production error output.
- Return generic client-safe error messages.
- Use stable error codes where appropriate.
- Generate a request or correlation identifier for troubleshooting where appropriate.
- Record detailed diagnostic information in protected server-side logs.
- Ensure sensitive values are excluded from logs as well as client responses.
- Configure framework and reverse-proxy error pages appropriately for production.
- Apply consistent handling across HTML and API responses.
- Re-test error paths after deployment configuration changes.
Example error-handling model
Application error
|
v
Central error handler
|
+----------------------+
| |
v v
Server-side log Client response
| |
Detailed diagnostics Safe error message
| |
Request ID <-------------+
|
v
Authorized operations team
Removing useful error information from the client without preserving diagnostic capability creates operational problems. The correct approach is to separate client-safe information from protected internal diagnostics.
Verification
Client responses are appropriately sanitized while diagnostic information remains available through controlled channels.
Unnecessary internal or security-sensitive information is exposed through client-facing error responses.
Error-handling behavior or production configuration could not be adequately verified.
Evidence requirements
Evidence must not publish passwords, API keys, session tokens, connection strings, private infrastructure details or other secrets. Redact sensitive values before attaching evidence to a public or externally shared assessment record.
Classification
| WebOTG procedure | WebOTG-SM-013 |
|---|---|
| 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 and usefulness of the disclosed information, exposure and resulting security impact. |
WebOTG-SM-013 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 | Verification requirements related to secure error handling and information exposure. |
| Application error-handling policy | Organization-specific requirements for client-facing errors and diagnostic logging. |
| Production deployment configuration | Verification of debug and diagnostic configuration in deployed environments. |
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.