Missing Custom Error Page

Incomplete Base
Structure: Simple
Description

This vulnerability occurs when an application fails to display its own user-friendly error pages, instead falling back to default system messages that can leak sensitive technical details.

Extended Description

When an application crashes or encounters an unexpected condition, the web server or framework often generates a default error response. These generic pages can be a goldmine for attackers, revealing stack traces, database schemas, server versions, internal file paths, or snippets of code. This exposed information significantly lowers the effort required for further exploitation, as it provides clear clues about the underlying technology and potential weaknesses. To prevent this, developers should implement a centralized error handler that intercepts all uncaught exceptions and HTTP error statuses (like 404 or 500). This handler must then respond with a consistent, branded page that informs the user a problem occurred—without any technical details—while logging the full diagnostic information securely on the server side for internal debugging. This simple practice improves both security and user experience.

Common Consequences 1
Scope: Confidentiality

Impact: Read Application Data

Attackers can leverage the additional information provided by a default error page to mount attacks targeted on the framework, database, or other resources used by the application.

Demonstrative Examples 2

ID : DX-76

In the snippet below, an unchecked runtime exception thrown from within the try block may cause the container to display its default error page (which may contain a full stack trace, among other things).

Code Example:

Bad
Java
java

ID : DX-75

The mode attribute of the <customErrors> tag in the Web.config file defines whether custom or default error pages are used.
In the following insecure ASP.NET application setting, custom error message mode is turned off. An ASP.NET error message with detailed stack trace and platform versions will be returned.

Code Example:

Bad
ASP.NET
asp.net
A more secure setting is to set the custom error message mode for remote users only. No defaultRedirect error page is specified. The local user on the web server will see a detailed stack trace. For remote users, an ASP.NET error message with the server customError configuration setting and the platform version will be returned.

Code Example:

Good
ASP.NET
asp.net
Another secure option is to set the mode attribute of the <customErrors> tag to use a custom page as follows:

Code Example:

Good
ASP.NET
asp.net