ASP.NET Misconfiguration: Missing Custom Error Page

Draft Variant
Structure: Simple
Description

An ASP .NET application must enable custom error pages in order to prevent attackers from mining information from the framework's built-in responses.

Common Consequences 1
Scope: Confidentiality

Impact: Read Application Data

Default error pages gives detailed information about the error that occurred, and should not be used in production environments. 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.

Potential Mitigations 3
Phase: System Configuration
Handle exceptions appropriately in source code. ASP .NET applications should be configured to use custom error pages instead of the framework default page.
Phase: Architecture and Design
Do not attempt to process an error or attempt to mask it.
Phase: Implementation
Verify return values are correct and do not supply sensitive information about the system.
Demonstrative Examples 1

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
References 3
Seven Pernicious Kingdoms: A Taxonomy of Software Security Errors
Katrina Tsipenyuk, Brian Chess, and Gary McGraw
NIST Workshop on Software Security Assurance Tools Techniques and MetricsNIST
07-11-2005
ID: REF-6
19 Deadly Sins of Software Security
M. Howard, D. LeBlanc, and J. Viega
McGraw-Hill/Osborne
26-07-2005
ID: REF-65
ASP.NET Misconfiguration: Missing Custom Error Handling
OWASP, Fortify Software
ID: REF-66
Applicable Platforms
Languages:
ASP.NET : Undetermined
Modes of Introduction
Implementation
Operation
Related Weaknesses
Taxonomy Mapping
  • 7 Pernicious Kingdoms