Skip to content

CWE-627: Dynamic Variable Evaluation

Variant

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.

Consequences

  • Confidentiality, Integrity, Availability: Modify Application Data, Execute Unauthorized Code or Commands

How to prevent it

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

Recent advisories

All advisories for CWE-627

Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor