CWE-540: Inclusion of Sensitive Information in Source Code
The product (such as a web server or repository) provides access to source code is not intended to be accessible to users but contains sensitive information.
Last updated
The product (such as a web server or repository) provides access to source code is not intended to be accessible to users but contains sensitive information.
Last updated
35 recorded CVEs are caused by CWE-540 (Inclusion of Sensitive Information in Source Code). The highest-severity and most recent are shown first. 11 new CWE-540 CVEs have been recorded so far in 2026 (8 in 2025).
IBM Analytics Content Hub information disclosure
Credential disclosure
QNAP AI Core
Inclusion of Sensitive Information in QSS
WebDyne versions from 2.022 before 3.022 for Perl disclose application source to unauthenticated clients via the viewer in the default index page
ChargePoint Home Flex Inclusion of Sensitive Information in Source Code Information Disclosure Vulnerability
Information Disclosure to Source Code in TNB Mobile Solutions' Cockpit Software
keerti1924 PHP-MYSQL-User-Login-System login.sql inclusion of sensitive information in source code
Showing 12 of 35 recorded CWE-540 CVEs. Get an alert for each new one, with AI-written analysis and fixes.
Monitor these CVEsWhat can happen when CWE-540 is exploited.
Read Application Data, Varies by Context
Affects: Confidentiality
Obtaining source code on a system allows an attacker to understand the logic of the script and extract extremely useful information such as code bugs or logins and passwords.
Typically introduced during these phases of the software lifecycle.
Technologies
Practical mitigations for CWE-540, grouped by where in the lifecycle they apply.
Recommendations include removing the script from the web server and moving it to a location not accessible from the Internet.
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.)
MITRE examples of the weakness in code.
The following code uses an include file to store database credentials:
Vulnerable example
<?php
$dbName = 'usersDB';
$dbPassword = 'skjdh#67nkjd3$3$';
?>Vulnerable example
<?php
include('database.inc');
$db = connectToDB($dbName, $dbPassword);
$db.authenticateUser($username, $password);
?>The following comment, embedded in a JSP, will be displayed in the resulting HTML output.
Vulnerable example
<!-- FIXME: calling this with more than 30 args kills the JDBC server -->Real CVEs that MITRE cites as examples of this weakness.
Common questions about CWE-540.
Weakness data is sourced from the MITRE CWE catalog (v4.21). CVE associations are aggregated and kept current by RadicalNotion.AI.
Get an alert when a new CWE-540 CVE affects your products, with AI-written analysis and remediation steps.