CWE-210: Self-generated Error Message Containing Sensitive Information

Description

The product identifies an error condition and creates its own diagnostic or error messages that contain sensitive information.

Submission Date :

July 19, 2006, midnight

Modification Date :

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

Organization :

MITRE
Example Vulnerable Codes

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


// # avoid CWE-22, CWE-78, others.// 
ExitError("Bad hacker!") ;
ExitError("Error: $filename does not exist");$uname = GetUserInput("username");if ($uname !~ /^\w+$/){}$filename = "/home/myprog/config/" . $uname . ".txt";if (!(-e $filename)){}

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.

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.