Führe statische Analyse (SAST) auf der Codebasis aus und suche im Datenfluss nach dem unsicheren Muster.
Inclusion of Sensitive Information in Source Code
This vulnerability occurs when sensitive information like passwords, API keys, or internal logic is exposed within source code that remains accessible on a web server or in a public repository.
What is CWE-540?
Real-world CVEs caused by CWE-540
-
Server for Team Awareness Kit (TAK) application includes sensitive tokens in the JavaScript source code.
-
The LDAP password might be visible in the html code of a rendered page in an IT Asset Management tool.
-
Version numbers and internal hostnames leaked in HTML comments.
Angreiferpfad Schritt für Schritt
- 1
The following code uses an include file to store database credentials:
- 2
database.inc
- 3
login.php
- 4
If the server does not have an explicit handler set for .inc files it may send the contents of database.inc to an attacker without pre-processing, if the attacker requests the file directly. This will expose the database name and password.
- 5
The following comment, embedded in a JSP, will be displayed in the resulting HTML output.
Vulnerable PHP
database.inc
<?php
$dbName = 'usersDB';
$dbPassword = 'skjdh#67nkjd3$3$';
?> Secure pseudo
// Validate, sanitize, or use a safe API before reaching the sink.
function handleRequest(input) {
const safe = validateAndEscape(input);
return executeWithGuards(safe);
} How to prevent CWE-540
- Architecture and Design / System Configuration Recommendations include removing this script from the web server and moving it to a location not accessible from the Internet.
How to detect CWE-540
Führe dynamische Application-Security-Tests gegen den Live-Endpoint aus.
Beobachte Runtime-Logs auf ungewöhnliche Exception-Traces, fehlerhafte Eingaben oder Versuche, Autorisierung zu umgehen.
Code Review: Markiere jeden neuen Code, der Eingaben von dieser Oberfläche ohne validierte Framework-Helper verarbeitet.
Plexicus erkennt CWE-540 automatisch und öffnet in unter 60 Sekunden einen Fix-PR.
Codex Remedium scannt jeden Commit, identifiziert genau diese Schwachstelle und liefert einen reviewer-ready Pull Request mit dem Patch. Keine Tickets. Keine Hand-offs.
Frequently asked questions
Was ist CWE-540?
This vulnerability occurs when sensitive information like passwords, API keys, or internal logic is exposed within source code that remains accessible on a web server or in a public repository.
Wie gravierend ist CWE-540?
MITRE hat für diese Schwachstelle keine Exploit-Wahrscheinlichkeit veröffentlicht. Behandle sie als mittlere Auswirkung, bis dein Threat Model anderes belegt.
Welche Sprachen oder Plattformen sind von CWE-540 betroffen?
MITRE hat für diese CWE keine betroffenen Plattformen spezifiziert — sie kann in den meisten Anwendungs-Stacks auftreten.
Wie kann ich CWE-540 verhindern?
Recommendations include removing this script from the web server and moving it to a location not accessible from the Internet.
Wie erkennt und behebt Plexicus CWE-540?
Die SAST-Engine von Plexicus erkennt die Datenfluss-Signatur von CWE-540 bei jedem Commit. Bei einem Treffer öffnet unser Codex-Remedium-Agent einen Fix-PR mit korrigiertem Code, Tests und einer einzeiligen Zusammenfassung für den Reviewer.
Wo erfahre ich mehr über CWE-540?
MITRE veröffentlicht die kanonische Definition unter https://cwe.mitre.org/data/definitions/540.html. Für ergänzende Hinweise kannst du auch die OWASP- und NIST-Dokumentation heranziehen.
Weaknesses related to CWE-540
Insertion of Sensitive Information into Externally-Accessible File or Directory
This vulnerability occurs when an application unintentionally stores confidential data—like passwords, API keys, or personal user…
Insertion of Sensitive Information into Log File
This vulnerability occurs when an application unintentionally writes confidential data, such as passwords or API keys, into its log files.
Exposure of WSDL File Containing Sensitive Information
This vulnerability occurs when a Web Service Definition Language (WSDL) file, which acts as a public blueprint for a web service, is…
Inclusion of Sensitive Information in Test Code
This vulnerability occurs when sensitive data, such as credentials, API keys, or internal logic, is embedded within test code or debugging…
Inclusion of Sensitive Information in an Include File
This vulnerability occurs when sensitive data like passwords or system details is placed inside a publicly accessible include file.…
Inclusion of Sensitive Information in Source Code Comments
This vulnerability occurs when developers leave sensitive details within source code comments. These can include internal file paths,…
Further reading
Schluss mit dem Bezahlen pro Entwickler.
Schließ den Kreislauf.
Plexicus ist die KI-native ASPM, die scannt, filtert, fixt, pentestet und erklärt — autonom. Unbegrenzte Entwickler, unbegrenzte Repos, Fair-Use-KI-Aktionen. Echter kostenloser Tarif, €269/mo jährlich, wenn du bereit bist.