CWE-532: Insertion of Sensitive Information into Log File
CWE版本: 4.18
更新日期: 2025-09-09
弱点描述
The product writes sensitive information to a log file.
常见后果
影响范围: 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.
潜在缓解措施
阶段: 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.
检测方法
方法: 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
观察示例
参考: CVE-2017-9615
verbose logging stores admin credentials in a world-readable log file
参考: CVE-2018-1999036
SSH password for private key stored in build log
引入模式
| 阶段 | 说明 |
|---|---|
| Architecture and Design | COMMISSION: This weakness refers to an incorrect design related to an architectural security tactic. |
| Implementation | - |
| Operation | - |
分类映射
| 分类名称 | 条目ID | 条目名称 | 映射适配度 |
|---|---|---|---|
| The CERT Oracle Secure Coding Standard for Java (2011) | FIO13-J | Do not log sensitive information outside a trust boundary | - |
| Software Fault Patterns | SFP23 | Exposed Data | - |