CWE-627: Dynamic Variable Evaluation
Official CWE-627 CWE context with Glexia analysis, remediation guidance, related CVEs, and ATT&CK context.
Glexia's Take
CWE-627: Dynamic evaluation
Dynamic Variable Evaluation represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.
Executive Impact
- Confidentiality,Integrity,Availability: Modify Application Data,Execute Unauthorized Code or Commands: An attacker could gain unauthorized access to internal program variables and execute arbitrary code.
Developer Pattern
CWE-627 is the kind of defect developers can usually prevent with explicit validation, safer framework defaults, and tests that exercise hostile input or unsafe state transitions.
Confidence
high confidence from CWE-627, 4.20.
Official CWE Definition
CWE-627: Dynamic Variable Evaluation
In a language where the user can influence the name of a variable at runtime, if the variable names are not controlled, an attacker can read or write to arbitrary variables, or access arbitrary functions.
The resultant vulnerabilities depend on the behavior of the application, both at the crossover point and in any control/data flow that is reachable by the related variables or functions.
Developer And Remediation Guidance
How teams prevent and detect this weakness
Causes
- Missing validation
- Unsafe defaults
- Insufficient authorization or memory-safety invariant
Remediation
- Implementation: Refactor the code to avoid dynamic variable evaluation whenever possible.
- Implementation: Use only allowlists of acceptable variable or function names.
- Implementation: For function names, ensure that you are only calling functions that accept the proper number of arguments, to avoid unexpected null arguments.
Detection
- Code review
- SAST
- DAST
- Focused regression tests
Mappings
Related CVEs, CWEs, and ATT&CK context
Related CWEs
ATT&CK Relevance
ATT&CK relevance is shown only when reviewed or responsibly inferred.