{"@ID": "211", "@Name": "Externally-Generated Error Message Containing Sensitive Information", "@Abstraction": "Base", "@Structure": "Simple", "@Status": "Incomplete", "Description": "The product performs an operation that triggers an external diagnostic or error message that is not directly generated or controlled by the product, such as an error generated by the programming language interpreter that a software application uses. The error can contain sensitive system information.", "Related_Weaknesses": {"Related_Weakness": {"@Nature": "ChildOf", "@CWE_ID": "209", "@View_ID": "1000", "@Ordinal": "Primary"}}, "Weakness_Ordinalities": {"Weakness_Ordinality": {"Ordinality": "Resultant"}}, "Applicable_Platforms": {"Language": [{"@Name": "PHP", "@Prevalence": "Often"}, {"@Class": "Not Language-Specific", "@Prevalence": "Undetermined"}], "Technology": {"@Class": "Not Technology-Specific", "@Prevalence": "Undetermined"}}, "Modes_Of_Introduction": {"Introduction": [{"Phase": "Architecture and Design", "Note": "PHP applications are often targeted for having this issue when the PHP interpreter generates the error outside of the application's control. However, other languages/environments exhibit the same issue."}, {"Phase": "Implementation", "Note": "REALIZATION: This weakness is caused during implementation of an architectural security tactic."}, {"Phase": "Operation"}]}, "Common_Consequences": {"Consequence": {"Scope": "Confidentiality", "Impact": "Read Application Data"}}, "Potential_Mitigations": {"Mitigation": [{"Phase": "System Configuration", "Description": "Configure the application's environment in a way that prevents errors from being generated. For example, in PHP, disable display_errors."}, {"@Mitigation_ID": "MIT-40", "Phase": ["Implementation", "Build and Compilation"], "Strategy": "Compilation or Build Hardening", "Description": "Debugging information should not make its way into a production release."}, {"@Mitigation_ID": "MIT-40", "Phase": ["Implementation", "Build and Compilation"], "Strategy": "Environment Hardening", "Description": "Debugging information should not make its way into a production release."}, {"Phase": "Implementation", "Description": "Handle exceptions internally and do not display errors containing potentially sensitive information to a user. Create default error pages if necessary."}, {"Phase": "Implementation", "Description": "The best way to prevent this weakness during implementation is to avoid any bugs that could trigger the external error message. This typically happens when the program encounters fatal errors, such as a divide-by-zero. You will not always be able to control the use of error pages, and you might not be using a language that handles exceptions."}]}, "Demonstrative_Examples": {"Demonstrative_Example": [{"@Demonstrative_Example_ID": "DX-190", "Intro_Text": "The following servlet code does not catch runtime exceptions, meaning that if such an exception were to occur, the container may display potentially dangerous information (such as a full stack trace).", "Example_Code": {"@Nature": "Bad", "@Language": "Java", "xhtml:div": {"xhtml:div": {"@style": "margin-left:1em;", "xhtml:div": {"xhtml:br": [null, null, null], "xhtml:i": "// May cause unchecked NullPointerException.", "xhtml:div": {"@style": "margin-left:1em;", "#text": "..."}, "#text": "String username = request.getParameter(\"username\");\n                           \n                           \n                           if (username.length() < 10) {}"}}, "#text": "public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {}"}, "#text_blocks": ["public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {", "String username = request.getParameter(\"username\");", "// May cause unchecked NullPointerException.", "if (username.length() < 10) {", "...", "}", "}"]}}, {"@Demonstrative_Example_ID": "DX-191", "Intro_Text": "In the following Java example the class InputFileRead enables an input file to be read using a FileReader object. In the constructor of this class a default input file path is set to some directory on the local file system and the method setInputFile must be called to set the name of the input file to be read in the default directory. The method readInputFile will create the FileReader object and will read the contents of the file. If the method setInputFile is not called prior to calling the method readInputFile then the File object will remain null when initializing the FileReader object. A Java RuntimeException will be raised, and an error message will be output to the user.", "Example_Code": {"@Nature": "Bad", "@Language": "Java", "xhtml:div": {"xhtml:br": null, "xhtml:div": {"@style": "margin-left:1em;", "xhtml:div": {"xhtml:br": [null, null, null, null, null, null, null, null, null], "xhtml:div": [{"@style": "margin-left:1em;", "#text": "inputFilePath = DEFAULT_FILE_PATH;"}, {"@style": "margin-left:1em;", "xhtml:div": {"xhtml:br": [null, null], "xhtml:i": "/* Assume appropriate validation / encoding is used and privileges / permissions are preserved */"}}, {"@style": "margin-left:1em;", "xhtml:div": {"xhtml:div": [{"@style": "margin-left:1em;", "xhtml:br": null, "#text": "reader = new FileReader(readFile);..."}, {"@style": "margin-left:1em;", "xhtml:br": null, "#text": "System.err.println(\"Error: Cannot open input file in the directory \" + inputFilePath);System.err.println(\"Input file has not been set, call setInputFile method before calling readInputFile\");"}], "xhtml:br": [null, null, null], "#text": "try {} catch (RuntimeException rex) {\n                                 \n                                 } catch (FileNotFoundException ex) {...}"}}], "#text": "private File readFile = null;private FileReader reader = null;private String inputFilePath = null;private final String DEFAULT_FILE_PATH = \"c:\\\\somedirectory\\\\\";\n                           public InputFileRead() {}\n                           public void setInputFile(String inputFile) {}\n                           public void readInputFile() {}"}}, "#text": "public class InputFileRead {\n                     }"}, "#text_blocks": ["public class InputFileRead {", "private File readFile = null;", "private FileReader reader = null;", "private String inputFilePath = null;", "private final String DEFAULT_FILE_PATH = \"c:\\\\somedirectory\\\\\";", "public InputFileRead() {", "inputFilePath = DEFAULT_FILE_PATH;", "}", "public void setInputFile(String inputFile) {", "/* Assume appropriate validation / encoding is used and privileges / permissions are preserved */", "}", "public void readInputFile() {", "try {", "reader = new FileReader(readFile);", "...", "} catch (RuntimeException rex) {", "System.err.println(\"Error: Cannot open input file in the directory \" + inputFilePath);", "System.err.println(\"Input file has not been set, call setInputFile method before calling readInputFile\");", "} catch (FileNotFoundException ex) {...}", "}", "}"]}, "Body_Text": "However, the error message output to the user contains information regarding the default directory on the local file system. This information can be exploited and may lead to unauthorized access or use of the system. Any Java RuntimeExceptions that are handled should not expose sensitive information to the user."}]}, "Observed_Examples": {"Observed_Example": [{"Reference": "CVE-2004-1581", "Description": "Chain: product does not protect against direct request of an include file, leading to resultant path disclosure when the include file does not successfully execute.", "Link": "https://www.cve.org/CVERecord?id=CVE-2004-1581"}, {"Reference": "CVE-2004-1579", "Description": "Single \"'\" inserted into SQL query leads to invalid SQL query execution, triggering full path disclosure. Possibly resultant from more general SQL injection issue.", "Link": "https://www.cve.org/CVERecord?id=CVE-2004-1579"}, {"Reference": "CVE-2005-0459", "Description": "Chain: product does not protect against direct request of a library file, leading to resultant path disclosure when the file does not successfully execute.", "Link": "https://www.cve.org/CVERecord?id=CVE-2005-0459"}, {"Reference": "CVE-2005-0443", "Description": "invalid parameter triggers a failure to find an include file, leading to infoleak in error message.", "Link": "https://www.cve.org/CVERecord?id=CVE-2005-0443"}, {"Reference": "CVE-2005-0433", "Description": "Various invalid requests lead to information leak in verbose error messages describing the failure to instantiate a class, open a configuration file, or execute an undefined function.", "Link": "https://www.cve.org/CVERecord?id=CVE-2005-0433"}, {"Reference": "CVE-2004-1101", "Description": "Improper handling of filename request with trailing \"/\" causes multiple consequences, including information leak in Visual Basic error message.", "Link": "https://www.cve.org/CVERecord?id=CVE-2004-1101"}]}, "Functional_Areas": {"Functional_Area": "Error Handling"}, "Taxonomy_Mappings": {"Taxonomy_Mapping": {"@Taxonomy_Name": "PLOVER", "Entry_Name": "Product-External Error Message Infoleak"}}, "Mapping_Notes": {"Usage": "Allowed", "Rationale": "This CWE entry is at the Base level of abstraction, which is a preferred level of abstraction for mapping to the root causes of vulnerabilities.", "Comments": "Carefully read both the name and description to ensure that this mapping is an appropriate fit. Do not try to 'force' a mapping to a lower-level Base/Variant simply to comply with this preferred level of abstraction.", "Reasons": {"Reason": {"@Type": "Acceptable-Use"}}}, "Notes": {"Note": {"@Type": "Relationship", "#text": "This is inherently a resultant vulnerability from a weakness within the product or an interaction error."}}, "Content_History": {"Submission": {"Submission_Name": "PLOVER", "Submission_Date": "2006-07-19", "Submission_Version": "Draft 3", "Submission_ReleaseDate": "2006-07-19"}, "Modification": [{"Modification_Name": "Eric Dalci", "Modification_Organization": "Cigital", "Modification_Date": "2008-07-01", "Modification_Version": "1.0", "Modification_ReleaseDate": "2008-09-09", "Modification_Comment": "updated Time_of_Introduction"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2008-09-08", "Modification_Version": "1.0", "Modification_ReleaseDate": "2008-09-09", "Modification_Comment": "updated Applicable_Platforms, Relationships, Other_Notes, Taxonomy_Mappings"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2008-10-14", "Modification_Version": "1.0.1", "Modification_ReleaseDate": "2008-10-14", "Modification_Comment": "updated Description"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2008-11-24", "Modification_Version": "1.1", "Modification_ReleaseDate": "2008-11-25", "Modification_Comment": "updated Description, Enabling_Factors_for_Exploitation, Functional_Areas, Observed_Examples, Other_Notes, Potential_Mitigations, Relationship_Notes, Weakness_Ordinalities"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2010-06-21", "Modification_Version": "1.9", "Modification_ReleaseDate": "2010-06-21", "Modification_Comment": "updated Potential_Mitigations"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2010-12-13", "Modification_Version": "1.11", "Modification_ReleaseDate": "2010-12-13", "Modification_Comment": "updated Observed_Examples"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2011-03-29", "Modification_Version": "1.12", "Modification_ReleaseDate": "2011-03-30", "Modification_Comment": "updated Name"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2011-06-01", "Modification_Version": "1.13", "Modification_ReleaseDate": "2011-06-01", "Modification_Comment": "updated Common_Consequences"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2012-05-11", "Modification_Version": "2.2", "Modification_ReleaseDate": "2012-05-15", "Modification_Comment": "updated Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2012-10-30", "Modification_Version": "2.3", "Modification_ReleaseDate": "2012-10-30", "Modification_Comment": "updated Name"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2014-07-30", "Modification_Version": "2.8", "Modification_ReleaseDate": "2014-07-31", "Modification_Comment": "updated Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2017-11-08", "Modification_Version": "3.0", "Modification_ReleaseDate": "2017-11-08", "Modification_Comment": "updated Applicable_Platforms, Enabling_Factors_for_Exploitation, Modes_of_Introduction, Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2020-02-24", "Modification_Version": "4.0", "Modification_ReleaseDate": "2020-02-24", "Modification_Comment": "updated Description, Name, Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2023-01-31", "Modification_Version": "4.10", "Modification_ReleaseDate": "2023-01-31", "Modification_Comment": "updated Description"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2023-04-27", "Modification_Version": "4.11", "Modification_ReleaseDate": "2023-04-27", "Modification_Comment": "updated Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2023-06-29", "Modification_Version": "4.12", "Modification_ReleaseDate": "2023-06-29", "Modification_Comment": "updated Mapping_Notes"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2024-02-29", "Modification_Version": "4.14", "Modification_ReleaseDate": "2024-02-29", "Modification_Comment": "updated Demonstrative_Examples"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2025-12-11", "Modification_Version": "4.19", "Modification_ReleaseDate": "2025-12-11", "Modification_Comment": "updated Applicable_Platforms"}], "Previous_Entry_Name": [{"@Date": "2011-03-29", "#text": "Product-External Error Message Information Leak"}, {"@Date": "2012-10-30", "#text": "Information Exposure Through External Error Message"}, {"@Date": "2020-02-24", "#text": "Information Exposure Through Externally-Generated Error Message"}]}, "entry_type": "Weakness"}
