CWE-454: External Initialization of Trusted Variables or Data Stores

Description

The product initializes critical internal variables or data stores using inputs that can be modified by untrusted actors.

Submission Date :

July 19, 2006, midnight

Modification Date :

2023-10-26 00:00:00+00:00

Organization :

MITRE
Extended Description

A product system should be reluctant to trust variables that have been initialized outside of its trust boundary, especially if they are initialized by users. The variables may have been initialized incorrectly. If an attacker can initialize the variable, then they can influence what the vulnerable system will do.

Example Vulnerable Codes

Example - 1

In the Java example below, a system property controls the debug level of the application.

int debugLevel = Integer.getInteger("com.domain.application.debugLevel").intValue();

If an attacker is able to modify the system property, then it may be possible to coax the application into divulging sensitive information by virtue of the fact that additional debug information is printed/exposed as the debug level increases.

Example - 2

This code checks the HTTP POST request for a debug switch, and enables a debug mode if the switch is set.


$debugEnabled = true;
// /.../// 

echo 'Debug Activated';phpinfo();$isAdmin = True;return True;if($debugEnabled){}$debugEnabled = false;if ($_POST["debug"] == "true"){}function login($username, $password){}

Any user can activate the debug mode, gaining administrator privileges. An attacker may also use the information printed by the phpinfo() function to further exploit the system. .

This example also exhibits Information Exposure Through Debug Information (CWE-215)

Related Weaknesses

This table shows the weaknesses and high level categories that are related to this weakness. These relationships are defined to give an overview of the different insight to similar items that may exist at higher and lower levels of abstraction.

Visit http://cwe.mitre.org/ for more details.