Self-generated Error Message Containing Sensitive Information

Draft Base
Structure: Simple
Description

This vulnerability occurs when an application detects a problem and generates its own error messages that accidentally expose sensitive system or user data.

Extended Description

Instead of using generic, safe error messages, the application crafts detailed responses that can reveal internal information. This might include database structure, server paths, configuration secrets, user credentials, or personal data, giving attackers valuable clues for further exploitation. Developers often create these verbose errors during debugging and forget to replace them before release. To prevent this, always use a centralized, secure logging and error-handling system that separates detailed diagnostic information (for internal logs) from benign, user-facing messages. Never let internal exception details or system information leak to end-users, APIs, or client-side code.

Common Consequences 1
Scope: Confidentiality

Impact: Read Application Data

Potential Mitigations 2
Phase: ImplementationBuild and Compilation

Strategy: Compilation or Build Hardening

Debugging information should not make its way into a production release.
Phase: ImplementationBuild and Compilation

Strategy: Environment Hardening

Debugging information should not make its way into a production release.
Demonstrative Examples 1
The following code uses custom configuration files for each user in the application. It checks to see if the file exists on the system before attempting to open and use the file. If the configuration file does not exist, then an error is generated, and the application exits.

Code Example:

Bad
Perl
perl

avoid CWE-22, CWE-78, others.*

perl
If this code is running on a server, such as a web application, then the person making the request should not know what the full pathname of the configuration directory is. By submitting a username that is not associated with a configuration file, an attacker could get this pathname from the error message. It could then be used to exploit path traversal, symbolic link following, or other problems that may exist elsewhere in the application.
Observed Examples 1
CVE-2005-1745Infoleak of sensitive information in error message (physical access required).
References 2
24 Deadly Sins of Software Security
Michael Howard, David LeBlanc, and John Viega
McGraw-Hill
2010
ID: REF-44
The Art of Software Security Assessment
Mark Dowd, John McDonald, and Justin Schuh
Addison Wesley
2006
ID: REF-62
Applicable Platforms
Languages:
Not Language-Specific : Undetermined
Modes of Introduction
Architecture and Design
Implementation
Taxonomy Mapping
  • PLOVER
  • Software Fault Patterns