CWE-454 Base Brouillon

External Initialization of Trusted Variables or Data Stores

This vulnerability occurs when an application sets up its critical internal variables or storage systems using data from untrusted, external sources that an attacker could control.

Définition

What is CWE-454?

This vulnerability occurs when an application sets up its critical internal variables or storage systems using data from untrusted, external sources that an attacker could control.
A secure system should be cautious about trusting any data that originates from outside its own controlled environment. When core application variables or data stores—like configuration flags, security tokens, or internal state trackers—are populated with user-supplied or externally-provided values, attackers can feed them malicious data. This allows them to manipulate the application's logic from the very start, often leading to severe security breaches. In practice, this means developers must ensure that all trusted variables are initialized with hard-coded values, secure internal processes, or rigorously validated data. Relying on external inputs for initialization, even if those inputs are later checked, creates a dangerous window where the system's foundational state is compromised. Always establish critical internal state independently, before processing any untrusted data.
Impact réel

Real-world CVEs caused by CWE-454

  • WordPress module sets internal variables based on external inputs, allowing false reporting of the number of views

  • Does not clear dangerous environment variables, enabling symlink attack.

  • Specify alternate configuration directory in environment variable, enabling untrusted path.

  • Dangerous environment variable not cleansed.

  • Specify arbitrary modules using environment variable.

Comment les attaquants l'exploitent

Parcours de l'attaquant étape par étape

  1. 1

    In the Java example below, a system property controls the debug level of the application.

  2. 2

    If an attacker is able to modify the system property, then it may be possible to coax the application into divulging sensitive information by virtue of the fact that additional debug information is printed/exposed as the debug level increases.

  3. 3

    This code checks the HTTP POST request for a debug switch, and enables a debug mode if the switch is set.

  4. 4

    Any user can activate the debug mode, gaining administrator privileges. An attacker may also use the information printed by the phpinfo() function to further exploit the system. .

  5. 5

    This example also exhibits Information Exposure Through Debug Information (CWE-215)

Exemple de code vulnérable

Vulnerable Java

In the Java example below, a system property controls the debug level of the application.

Vulnérable Java
int debugLevel = Integer.getInteger("com.domain.application.debugLevel").intValue();
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-454

  • Implementation A product system should be reluctant to trust variables that have been initialized outside of its trust boundary. Ensure adequate checking (e.g. input validation) is performed when relying on input from outside a trust boundary.
  • Architecture and Design Avoid any external control of variables. If necessary, restrict the variables that can be modified using an allowlist, and use a different namespace or naming convention if possible.
Signaux de détection

How to detect CWE-454

SAST High

Exécuter une analyse statique (SAST) sur le code source à la recherche du motif non sécurisé dans le flux de données.

DAST Moderate

Exécuter des tests de sécurité applicative dynamique (DAST) contre le point de terminaison en ligne.

Runtime Moderate

Surveiller les journaux runtime pour détecter des traces d'exception inhabituelles, des entrées malformées ou des tentatives de contournement d'autorisation.

Code review Moderate

Revue de code : signaler tout nouveau code qui traite les entrées de cette surface sans utiliser les helpers du framework validés.

Correction automatique Plexicus

Plexicus détecte automatiquement CWE-454 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-454 ?

This vulnerability occurs when an application sets up its critical internal variables or storage systems using data from untrusted, external sources that an attacker could control.

Quelle est la gravité de CWE-454 ?

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

MITRE lists the following affected platforms: PHP.

Comment puis-je prévenir CWE-454 ?

A product system should be reluctant to trust variables that have been initialized outside of its trust boundary. Ensure adequate checking (e.g. input validation) is performed when relying on input from outside a trust boundary. Avoid any external control of variables. If necessary, restrict the variables that can be modified using an allowlist, and use a different namespace or naming convention if possible.

Comment Plexicus détecte et corrige CWE-454 ?

Le moteur SAST de Plexicus reconnaît la signature de flux de données de CWE-454 à 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-454 ?

MITRE publie la définition canonique à https://cwe.mitre.org/data/definitions/454.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.