Missing Custom Error Page

Incomplete Base
Structure: Simple
Description

The product does not return custom error pages to the user, possibly exposing sensitive information.

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