The product writes sensitive information to a log file.

Primary

Resultant

Architecture and Design
COMMISSION: This weakness refers to an incorrect design related to an architectural security tactic.

Implementation

Operation

Medium

Confidentiality
Read Application Data
Logging sensitive user data, full path names, or system information often provides attackers with an additional, less-protected path to acquiring the information.

Automated Static Analysis
Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)
High

Architecture and Design
Implementation
Consider seriously the sensitivity of the information written into log files. Do not write secrets into the log files.

Distribution
Remove debug log files before deploying the application into production.

Operation
Protect log files against unauthorized read/write.

Implementation
Adjust configurations appropriately when software is transitioned from a debug state to production.

In the following code snippet, a user's full name and credit card number are written to a log file.

logger.info("Username: " + usernme + ", CCN: " + ccn);

This code stores location information about the current user:

locationClient = new LocationClient(this, this, this);locationClient.connect();currentUser.setLocation(locationClient.getLastLocation());
...

catch (Exception e) {AlertDialog.Builder builder = new AlertDialog.Builder(this);builder.setMessage("Sorry, this application has experienced an error.");AlertDialog alert = builder.create();alert.show();Log.e("ExampleActivity", "Caught exception: " + e + " While on User:" + User.toString());}

When the application encounters an exception it will write the user object to the log. Because the user object contains location information, the user's location is also written to the log.

In the example below, the method getUserBankAccount retrieves a bank account object from a database using the supplied username and account number to query the database. If an SQLException is raised when querying the database, an error message is created and output to a log file.

public BankAccount getUserBankAccount(String username, String accountNumber) {
BankAccount userAccount = null;String query = null;try {if (isAuthorizedUser(username)) {query = "SELECT * FROM accounts WHERE owner = "+ username + " AND accountID = " + accountNumber;DatabaseManager dbManager = new DatabaseManager();Connection conn = dbManager.getConnection();Statement stmt = conn.createStatement();ResultSet queryResult = stmt.executeQuery(query);userAccount = (BankAccount)queryResult.getObject(accountNumber);}} catch (SQLException ex) {String logMessage = "Unable to retrieve account information from database,\nquery: " + query;Logger.getLogger(BankManager.class.getName()).log(Level.SEVERE, logMessage, ex);}return userAccount;
}

The error message that is created includes information about the database query that may contain sensitive information about the database or query logic. In this case, the error message will expose the table name and column names used in the database. This data could be used to simplify other attacks, such as SQL injection (CWE-89) to directly access the database.

CVE-2017-9615
verbose logging stores admin credentials in a world-readable log file
https://www.cve.org/CVERecord?id=CVE-2017-9615

CVE-2018-1999036
SSH password for private key stored in build log
https://www.cve.org/CVERecord?id=CVE-2018-1999036

FIO13-J
Do not log sensitive information outside a trust boundary

SFP23
Exposed Data

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

Anonymous Tool Vendor (under NDA)
2006-07-19
Draft 3
2006-07-19

Sean Eidemiller
Cigital
2008-07-01
added/updated demonstrative examples

Eric Dalci
Cigital
2008-07-01
updated Potential_Mitigations, Time_of_Introduction

CWE Content Team
MITRE
2008-09-08
updated Relationships, Taxonomy_Mappings

CWE Content Team
MITRE
2009-03-10
updated Relationships

CWE Content Team
MITRE
2009-07-27
updated Common_Consequences, Description, Likelihood_of_Exploit, Potential_Mitigations

CWE Content Team
MITRE
2011-03-29
updated Name

CWE Content Team
MITRE
2011-06-01
updated Common_Consequences, Relationships, Taxonomy_Mappings

CWE Content Team
MITRE
2012-05-11
updated Related_Attack_Patterns, Relationships, Taxonomy_Mappings

CWE Content Team
MITRE
2014-02-18
updated Demonstrative_Examples

CWE Content Team
MITRE
2014-07-30
updated Relationships, Taxonomy_Mappings

CWE Content Team
MITRE
2015-12-07
updated Relationships

CWE Content Team
MITRE
2017-11-08
updated Modes_of_Introduction, Relationships, Taxonomy_Mappings

CWE Content Team
MITRE
2018-03-27
updated Description, Potential_Mitigations, Relationships

CWE Content Team
MITRE
2019-01-03
updated Relationships, Taxonomy_Mappings

CWE Content Team
MITRE
2019-06-20
updated Name, Relationships

CWE Content Team
MITRE
2019-09-19
updated Demonstrative_Examples, Observed_Examples

CWE Content Team
MITRE
2020-02-24
updated Name, Relationships, Type

CWE Content Team
MITRE
2021-10-28
updated Relationships

CWE Content Team
MITRE
2023-04-27
updated Detection_Factors, Relationships

CWE Content Team
MITRE
2023-06-29
updated Mapping_Notes

CWE Content Team
MITRE
2023-10-26
updated Demonstrative_Examples, Observed_Examples

CWE Content Team
MITRE
2024-11-19
4.16
2024-11-19
updated Common_Consequences, Description, Diagram

CWE Content Team
MITRE
2025-12-11
4.19
2025-12-11
updated Applicable_Platforms, Relationships, Weakness_Ordinalities

Fortify Software
2009-07-15
Portions of Mitigations, Consequences and Description derived from content submitted by Fortify Software.

Abhi Balakrishnan
2024-10-14
4.16
2024-11-19
Provided diagram to improve CWE usability

Information Leak Through Log Files
Information Exposure Through Log Files
Inclusion of Sensitive Information in Log Files