CWE-756: Missing Custom Error Page

Description

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

Submission Date :

March 3, 2009, midnight

Modification Date :

2023-06-29 00:00:00+00:00

Organization :

MITRE
Example Vulnerable Codes

Example - 1

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).

...logger.error("Caught: " + ase.toString());try {} catch (ApplicationSpecificException ase) {}Public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {}

Example - 2

The mode attribute of the 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.

<customErrors mode="Off" />

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.

<customErrors mode="RemoteOnly" />

Another secure option is to set the mode attribute of the tag to use a custom page as follows:

<customErrors mode="On" defaultRedirect="YourErrorPage.htm" />

Related Weaknesses

This table shows the weaknesses and high level categories that are related to this weakness. These relationships are defined to give an overview of the different insight to similar items that may exist at higher and lower levels of abstraction.

Visit http://cwe.mitre.org/ for more details.