CWE
Home > CWE List > CWE- Individual Dictionary Definition (1.1)  
Search by ID:

CWE-627: Dynamic Variable Evaluation

Individual Definition in a New Window
Dynamic Variable Evaluation
Status: Incomplete
Weakness ID: 627 (Weakness Base)
Description
Summary

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. functions.

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

Alternate Terms
Dynamic evaluation
Potential Mitigations

Avoid dynamic evaluation whenever possible.

Use only whitelists 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.

Background Details

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).

Research Gaps

Under-studied, probably under-reported. Few researchers look for this issue; most public reports are for PHP, although other languages are affected. This issue is likely to grow in PHP as developers begin to implement functionality in place of register_globals.

References
Steve Christey. "Dynamic Evaluation Vulnerabilities in PHP applications". Full-Disclosure. 2006-05-03. <http://seclists.org/fulldisclosure/2006/May/0035.html>.
Shaun Clowes. "A Study In Scarlet: Exploiting Common Vulnerabilities in PHP Applications". <http://www.securereality.com.au/studyinscarlet.txt>.
Relationships
NatureTypeIDNameView(s) this relationship pertains toView(s)
ChildOfWeakness ClassWeakness ClassWeakness Class94Code Injection
Development Concepts (primary)699
Research Concepts (primary)1000
PeerOfWeakness BaseWeakness BaseWeakness Base621Variable Extraction Error
Research Concepts1000
PeerOfWeakness BaseWeakness BaseWeakness Base183Permissive Whitelist
Research Concepts1000
Applicable Platforms
Languages
PHP
Perl
Time of Introduction
* Implementation
Content History
Modifications
Eric Dalci. Cigital. 2008-07-01. (External)
updated Time_of_Introduction
CWE Content Team. MITRE. 2008-09-08. (Internal)
updated Applicable_Platforms, Relationships
CWE Content Team. MITRE. 2008-10-14. (Internal)
updated Background_Details, Description
Page Last Updated: November 24, 2008