ASP.NET Misconfiguration: Missing Custom Error Page

Draft Variant
Structure: Simple
Description

This vulnerability occurs when an ASP.NET application fails to configure custom error pages, allowing attackers to extract sensitive information from the framework's default error messages.

Extended Description

When an ASP.NET application encounters an error, it can reveal detailed technical information in its default response, such as stack traces, server file paths, database connection details, or snippets of source code. Attackers actively probe for these errors to gather intelligence about your application's internal structure, which they can then use to plan more targeted and damaging attacks. To prevent this, you must configure custom error pages in your web.config file. This ensures that any runtime errors display a generic, user-friendly message to visitors while logging the full technical details securely on the server. This simple configuration step acts as a critical layer of defense, stopping information leaks that could compromise your entire application.

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