Ejecuta análisis estático (SAST) sobre el código buscando el patrón inseguro en el flujo de datos.
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.
Ruta del atacante paso a paso
- 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
Ejecuta pruebas dinámicas de seguridad de aplicaciones (DAST) contra el endpoint en vivo.
Vigila los logs en tiempo de ejecución para detectar trazas de excepción inusuales, entradas malformadas o intentos de bypass de autorización.
Revisión de código: marca cualquier código nuevo que maneje entrada desde esta superficie sin usar los helpers validados del framework.
Plexicus detecta automáticamente CWE-540 y abre un PR de corrección en menos de 60 segundos.
Codex Remedium escanea cada commit, identifica esta debilidad concreta y entrega un pull request listo para revisión con el parche. Sin tickets. Sin traspasos.
Frequently asked questions
¿Qué es 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.
¿Qué gravedad tiene CWE-540?
MITRE no ha publicado una calificación de probabilidad de explotación para esta debilidad. Trátala como de impacto medio hasta que tu modelo de amenazas demuestre lo contrario.
¿Qué lenguajes o plataformas se ven afectados por CWE-540?
MITRE no ha especificado plataformas afectadas para esta CWE — puede aplicar a la mayoría de los stacks de aplicaciones.
¿Cómo puedo prevenir CWE-540?
Recommendations include removing this script from the web server and moving it to a location not accessible from the Internet.
¿Cómo detecta y corrige Plexicus CWE-540?
El motor SAST de Plexicus detecta la firma de flujo de datos para CWE-540 en cada commit. Cuando hay coincidencia, nuestro agente Codex Remedium abre un PR de corrección con el código corregido, las pruebas y un resumen de una línea para el revisor.
¿Dónde puedo aprender más sobre CWE-540?
MITRE publica la definición canónica en https://cwe.mitre.org/data/definitions/540.html. También puedes consultar la documentación de OWASP y NIST para guías relacionadas.
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,…
Deja de pagar por desarrollador.
Empieza a cerrar el bucle.
Plexicus es el ASPM nativo de IA que escanea, filtra, corrige, pentestea y explica — de forma autónoma. Desarrolladores ilimitados, repos ilimitados, acciones de IA de uso justo. Nivel gratuito real, €269/mo anual cuando estés listo.