CWE-914: Improper Control of Dynamically-Identified Variables

Export to Word

Description

The product does not properly restrict reading from or writing to dynamically-identified variables.

Extended Description

Many languages offer powerful features that allow the programmer to access arbitrary variables that are specified by an input string. While these features can offer significant flexibility and reduce development time, they can be extremely dangerous if attackers can modify unintended variables that have security implications.


ThreatScore

Threat Mapped score: 0.0

Industry: Finiancial

Threat priority: Unclassified


Observed Examples (CVEs)

Related Attack Patterns (CAPEC)

N/A


Attack TTPs

N/A

Modes of Introduction

Phase Note
Implementation N/A

Common Consequences

Potential Mitigations

Applicable Platforms


Demonstrative Examples

Intro: This code uses the credentials sent in a POST request to login a user.

Body: The call to extract() will overwrite the existing values of any variables defined previously, in this case $isAdmin. An attacker can send a POST request with an unexpected third value "isAdmin" equal to "true", thus gaining Admin privileges.

//Log user in, and set $isAdmin to true if user is an administrator function login($user,$pass){ $query = buildQuery($user,$pass); mysql_query($query); if(getUserRole($user) == "Admin"){ $isAdmin = true; } } $isAdmin = false; extract($_POST); login(mysql_real_escape_string($user),mysql_real_escape_string($pass));

Notes

← Back to CWE list