CWE-914 Base Incomplete

Improper Control of Dynamically-Identified Variables

This vulnerability occurs when an application fails to properly secure access to variables whose names are determined at runtime, allowing attackers to read or modify data they shouldn't have access…

Definition

What is CWE-914?

This vulnerability occurs when an application fails to properly secure access to variables whose names are determined at runtime, allowing attackers to read or modify data they shouldn't have access to.
Many programming languages provide dynamic variable access features—like using string inputs to directly reference variable names—which can accelerate development by offering great flexibility. However, when these features accept unvalidated user input, they create a dangerous pathway for attackers to manipulate critical variables controlling authentication, authorization, or application logic. This risk is especially severe because attackers can often guess or discover variable names with security significance, such as those holding user permissions, configuration flags, or sensitive data. To prevent this, developers must avoid using dynamic variable access with user-controlled input entirely, or implement strict allow-list validation to restrict which variable names can be referenced through these mechanisms.
Auswirkungen in der Praxis

Real-world CVEs caused by CWE-914

  • extract issue enables file inclusion

  • Chain: extract used for register_globals compatibility layer, enables path traversal (CWE-22)

  • extract() buried in include files makes post-disclosure analysis confusing; original report had seemed incorrect.

  • extract() enables static code injection

  • import_request_variables() buried in include files makes post-disclosure analysis confusing

  • Chain: Dynamic variable evaluation allows resultant remote file inclusion and path traversal.

  • Chain: dynamic variable evaluation in PHP program used to modify critical, unexpected $_SERVER variable for resultant XSS.

  • Chain: dynamic variable evaluation in PHP program used to conduct remote file inclusion.

Wie Angreifer es ausnutzen

Angreiferpfad Schritt für Schritt

  1. 1

    Identifiziere einen Codepfad, der nicht vertrauenswürdige Eingaben ohne Validierung verarbeitet.

  2. 2

    Erzeuge eine Payload, die das unsichere Verhalten auslöst — Injection, Traversal, Overflow oder Logik-Missbrauch.

  3. 3

    Liefere die Payload über einen normalen Request aus und beobachte die Reaktion der Anwendung.

  4. 4

    Iteriere, bis die Antwort Daten preisgibt, Angreifer-Code ausführt oder Berechtigungen eskaliert.

Verwundbares Codebeispiel

Vulnerable PHP

This code uses the credentials sent in a POST request to login a user.

Verwundbar PHP
```
//Log user in, and set $isAdmin to true if user is an administrator* 
  
  function login($user,$pass){
  ```
  	$query = buildQuery($user,$pass);
  	mysql_query($query);
  	if(getUserRole($user) == "Admin"){
  		$isAdmin = true;
  	}
  }
  $isAdmin = false;
  extract($_POST);
  login(mysql_real_escape_string($user),mysql_real_escape_string($pass));
Sicheres Codebeispiel

Secure pseudo

Sicher 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.
Präventions-Checkliste

How to prevent CWE-914

  • Implementation For any externally-influenced input, check the input against an allowlist of internal program variables that are allowed to be modified.
  • Implementation / Architecture and Design Refactor the code so that internal program variables do not need to be dynamically identified.
Erkennungssignale

How to detect CWE-914

SAST High

Führe statische Analyse (SAST) auf der Codebasis aus und suche im Datenfluss nach dem unsicheren Muster.

DAST Moderate

Führe dynamische Application-Security-Tests gegen den Live-Endpoint aus.

Runtime Moderate

Beobachte Runtime-Logs auf ungewöhnliche Exception-Traces, fehlerhafte Eingaben oder Versuche, Autorisierung zu umgehen.

Code review Moderate

Code Review: Markiere jeden neuen Code, der Eingaben von dieser Oberfläche ohne validierte Framework-Helper verarbeitet.

Plexicus Auto-Fix

Plexicus erkennt CWE-914 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.

Häufig gestellte Fragen

Frequently asked questions

Was ist CWE-914?

This vulnerability occurs when an application fails to properly secure access to variables whose names are determined at runtime, allowing attackers to read or modify data they shouldn't have access to.

Wie gravierend ist CWE-914?

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-914 betroffen?

MITRE hat für diese CWE keine betroffenen Plattformen spezifiziert — sie kann in den meisten Anwendungs-Stacks auftreten.

Wie kann ich CWE-914 verhindern?

For any externally-influenced input, check the input against an allowlist of internal program variables that are allowed to be modified. Refactor the code so that internal program variables do not need to be dynamically identified.

Wie erkennt und behebt Plexicus CWE-914?

Die SAST-Engine von Plexicus erkennt die Datenfluss-Signatur von CWE-914 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-914?

MITRE veröffentlicht die kanonische Definition unter https://cwe.mitre.org/data/definitions/914.html. Für ergänzende Hinweise kannst du auch die OWASP- und NIST-Dokumentation heranziehen.

Bereit, wenn du es bist

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.