| Home > CAPEC List > CAPEC-77: Manipulating User-Controlled Variables (Version 3.9) |
|
High
Very High
| Nature | Type | ID | Name |
|---|---|---|---|
| ChildOf | Meta Attack PatternMeta Attack Pattern - A meta level attack pattern in CAPEC is a decidedly abstract characterization of a specific methodology or technique used in an attack. A meta attack pattern is often void of a specific technology or implementation and is meant to provide an understanding of a high level approach. A meta level attack pattern is a generalization of related group of standard level attack patterns. Meta level attack patterns are particularly useful for architecture and design level threat modeling exercises. | 22 | Exploiting Trust in Client |
| ParentOf | Detailed Attack PatternDetailed Attack Pattern - A detailed level attack pattern in CAPEC provides a low level of detail, typically leveraging a specific technique and targeting a specific technology, and expresses a complete execution flow. Detailed attack patterns are more specific than meta attack patterns and standard attack patterns and often require a specific protection mechanism to mitigate actual attacks. A detailed level attack pattern often will leverage a number of different standard level attack patterns chained together to accomplish a goal. | 13 | Subverting Environment Variable Values |
| ParentOf | Detailed Attack PatternDetailed Attack Pattern - A detailed level attack pattern in CAPEC provides a low level of detail, typically leveraging a specific technique and targeting a specific technology, and expresses a complete execution flow. Detailed attack patterns are more specific than meta attack patterns and standard attack patterns and often require a specific protection mechanism to mitigate actual attacks. A detailed level attack pattern often will leverage a number of different standard level attack patterns chained together to accomplish a goal. | 162 | Manipulating Hidden Fields |
| View Name | Top Level Categories |
|---|---|
| Domains of Attack | Software |
| Mechanisms of Attack | Subvert Access Control |
Probe target application: The adversary first probes the target application to determine important information about the target. This information could include types software used, software versions, what user input the application consumes, and so on.
Find user-controlled variables: Using the information found by probing the application, the adversary attempts to manipulate many user-controlled variables and observes the effects on the application. If the adversary notices any significant changes to the application, they will know that a certain variable is useful to the application.
| Techniques |
|---|
| Adversaries will try to alter many common variable names such as "count", "tempFile", "i", etc. The hope is that they can alter the flow of the application without knowing the inner-workings. |
| Adversaries will try to alter known environment variables. |
Manipulate user-controlled variables: Once the adversary has found a user-controller variable(s) that is important to the application, they will manipulate it to change the normal behavior in a way that benefits the adversary.
| Scope | Impact | Likelihood |
|---|---|---|
Integrity | Modify Data | |
Confidentiality Integrity Availability | Execute Unauthorized Commands | |
Confidentiality | Read Data | |
Confidentiality Access Control Authorization | Gain Privileges |
Do not allow override of global variables and do Not Trust Global Variables.
If the register_globals option is enabled, PHP will create global variables for each GET, POST, and cookie variable included in the HTTP request. This means that a malicious user may be able to set variables unexpectedly. For instance make sure that the server setting for PHP does not expose global variables.
PHP is a study in bad security. The main idea pervading PHP is "ease of use," and the mantra "don't make the developer go to any extra work to get stuff done" applies in all cases. This is accomplished in PHP by removing formalism from the language, allowing declaration of variables on first use, initializing everything with preset values, and taking every meaningful variable from a transaction and making it available. In cases of collision with something more technical, the simple almost always dominates in PHP.
One consequence of all this is that PHP allows users of a Web application to override environment variables with user-supplied, untrusted query variables. Thus, critical values such as the CWD and the search path can be overwritten and directly controlled by a remote anonymous user.
Another similar consequence is that variables can be directly controlled and assigned from the user-controlled values supplied in GET and POST request fields. So seemingly normal code like this, does bizarre things:
Normally, this loop will execute its body ten times. The first iteration will be an undefined zero, and further trips though the loop will result in an increment of the variable $count. The problem is that the coder does not initialize the variable to zero before entering the loop. This is fine because PHP initializes the variable on declaration. The result is code that seems to function, regardless of badness. The problem is that a user of the Web application can supply a request such as
and cause $count to start out at the value 9, resulting in only one trip through the loop. Yerg.
Depending on the configuration, PHP may accept user-supplied variables in place of environment variables. PHP initializes global variables for all process environment variables, such as $PATH and $HOSTNAME. These variables are of critical importance because they may be used in file or network operations. If an adversary can supply a new $PATH variable (such as PATH='/var'), the program may be exploitable.
PHP may also take field tags supplied in GET/POST requests and transform them into global variables. This is the case with the $count variable we explored in our previous example.
Consider another example of this problem in which a program defines a variable called $tempfile. An adversary can supply a new temp file such as $tempfile = "/etc/passwd". Then the temp file may get erased later via a call to unlink($tempfile);. Now the passwd file has been erased--a bad thing indeed on most OSs.
Also consider that the use of include() and require() first search $PATH, and that using calls to the shell may execute crucial programs such as ls. In this way, ls may be "Trojaned" (the adversary can modify $PATH to cause a Trojan copy of ls to be loaded). This type of attack could also apply to loadable libraries if $LD_LIBRARY_PATH is modified.
Finally, some versions of PHP may pass user data to syslog as a format string, thus exposing the application to a format string buffer overflow.
See also: File upload allows arbitrary file read by setting hidden form variables to match internal variable names (CVE-2000-0860)| CWE-ID | Weakness Name |
|---|---|
| 15 | External Control of System or Configuration Setting |
| 94 | Improper Control of Generation of Code ('Code Injection') |
| 96 | Improper Neutralization of Directives in Statically Saved Code ('Static Code Injection') |
| 285 | Improper Authorization |
| 302 | Authentication Bypass by Assumed-Immutable Data |
| 473 | PHP External Variable Modification |
| 1321 | Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution') |
| Submissions | ||
|---|---|---|
| Submission Date | Submitter | Organization |
| 2014年06月23日 (Version 2.6) | CAPEC Content Team | The MITRE Corporation |
| Modifications | ||
| Modification Date | Modifier | Organization |
| 2017年01月09日 (Version 2.9) | CAPEC Content Team | The MITRE Corporation |
| Updated Related_Attack_Patterns | ||
| 2019年04月04日 (Version 3.1) | CAPEC Content Team | The MITRE Corporation |
| Updated Related_Attack_Patterns | ||
| 2020年07月30日 (Version 3.3) | CAPEC Content Team | The MITRE Corporation |
| Updated Execution_Flow, Mitigations, Skills_Required | ||
| 2020年12月17日 (Version 3.4) | CAPEC Content Team | The MITRE Corporation |
| Updated Related_Weaknesses | ||
| 2022年02月22日 (Version 3.7) | CAPEC Content Team | The MITRE Corporation |
| Updated Description, Example_Instances, Execution_Flow, Skills_Required | ||
| 2022年09月29日 (Version 3.8) | CAPEC Content Team | The MITRE Corporation |
| Updated Example_Instances | ||
|
Use of the Common Attack Pattern Enumeration and Classification (CAPEC), and the associated references from this website are subject to the Terms of Use. Copyright © 2007–2025, The MITRE Corporation. CAPEC and the CAPEC logo are trademarks of The MITRE Corporation. |
||