Also known as: Dynamic 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.
Last updated
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.
Many interpreted languages support the use of a "$$varname" construct to set a variable whose name is specified by the $varname variable. In PHP, these are referred to as "variable variables." Functions might also be invoked using similar syntax, such as $$funcname(arg1, arg2).
5 recorded CVEs are caused by CWE-627 (Dynamic Variable Evaluation). The highest-severity and most recent are shown first. 3 new CWE-627 CVEs have been recorded so far in 2026 (1 in 2025).
Unsafe variable evaluation in email templates
What can happen when CWE-627 is exploited.
Modify Application Data, Execute Unauthorized Code or Commands
Affects: Confidentiality, Integrity, Availability
An attacker could gain unauthorized access to internal program variables and execute arbitrary code.
Typically introduced during these phases of the software lifecycle.
Languages
Practical mitigations for CWE-627, grouped by where in the lifecycle they apply.
Refactor the code to avoid dynamic variable evaluation whenever possible.
Use only allowlists of acceptable variable or function names.
For function names, ensure that you are only calling functions that accept the proper number of arguments, to avoid unexpected null arguments.
Real CVEs that MITRE cites as examples of this weakness.
Common questions about CWE-627.
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.
5 recorded CVEs are attributed to CWE-627, including CVE-2026-2452, CVE-2026-2451, CVE-2026-2415.
Refactor the code to avoid dynamic variable evaluation whenever possible.
Exploiting CWE-627 can lead to: Modify Application Data, Execute Unauthorized Code or Commands.
5 recorded CVEs are caused by CWE-627; none are currently in CISA's KEV catalog of actively exploited flaws.
Weakness data is sourced from the MITRE CWE catalog (v4.20). CVE associations are aggregated and kept current by RadicalNotion.AI.
Get alerted the moment a new CWE-627 vulnerability affects your stack, with AI-written analysis, severity context, and remediation guidance.