Skip to main content

CWE-627: Dynamic Variable Evaluation

VariantIncomplete

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.

View on MITRE
Back to CWE Lookup

Extended Description

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.

Technical Details

Structure
Simple

Applicable To

Languages
PHPPerl
Platforms

Frequently Asked Questions

What is CWE-627: Dynamic Variable Evaluation?+

CWE-627: Dynamic Variable Evaluation is a Common Weakness Enumeration (CWE) entry maintained by MITRE. 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.

What are the security consequences of Dynamic Variable Evaluation?+

If exploited, CWE-627 (Dynamic Variable Evaluation) it can compromise Confidentiality, Integrity and Availability, leading to outcomes such as Modify Application Data and Execute Unauthorized Code or Commands.

How do you prevent or mitigate Dynamic Variable Evaluation?+

Recommended mitigations for CWE-627 include: 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.

Which programming languages are affected by Dynamic Variable Evaluation?+

CWE-627 commonly affects PHP and Perl. Note that weaknesses are often language-agnostic patterns, so secure coding practices apply broadly.

What are real-world examples of Dynamic Variable Evaluation?+

MITRE documents real CVEs mapped to CWE-627, including CVE-2009-0422, CVE-2007-2431, CVE-2006-4904 and CVE-2006-4019. You can look up the full details of each CVE, including CVSS scores and remediation guidance, on our CVE Lookup tool.

What is the difference between a CWE and a CVE?+

A CWE (Common Weakness Enumeration) like CWE-627 describes a category of software weakness — the underlying flaw type. A CVE (Common Vulnerabilities and Exposures) identifies a specific, real-world vulnerability in a particular product. In short, a CWE is the kind of mistake, and a CVE is an instance of that mistake being found in software.

Learn More